0

i was tackling with networking and cannot seem to understand How bits are transferred over wires in the first place what counts for each of 0's & 1's

1
  • This question is a basic networking question and not an infosec question.
    – schroeder
    Apr 4, 2015 at 15:40

1 Answer 1

1

First of all I do not think this is belonging to Security SE Please read Security SE policy regarding questions. Its more of Physics. if I am correct!

I recommend you to read this article about Data Transimission require basic knowledge of physics Simple way to find more about your question with no prior knowledge of physics is understanding Layer 1.

But however more regarding to your question. Date Transmit is just varying voltage levels in a circuit formed by the network cables.You will find that the details are fiendishly complicated and far too involved to reproduce here. Even the voltage levels used depend on whether it's 10MHz, 100MHz or GHz cabling. GHz uses five voltage levels and pulse amplitude modulation.

The simplest starting point is probably the Wikipedia article on Ethernet over twisted pair. If you want to know more about how the information is encoded look at the Cisco article on Ethernet.

Edit: As @munchkin mentioned not to forget about Endianness and I personally think it is such fundamental part to understand.

First, Endianness, is memory stores the binary data by oprganizing it 8-bit units(bytes) which we called Octec Not to confuse with Octal And how the bytes are ordered within momery:

But really to understand Endianness we need to know word

Wiki: In computing, word is a term for the natural unit of data used by a particular processor design. A word is a fixed-sized piece of data handled as a unit by the instruction set or the hardware of the processor. The number of bytes in a word (the word size, word width, or word length) is an important characteristic of any specific processor design or computer architecture.

Now, Assuming you know about Word, Memory, etc.

Big-Endian System:

**Most Significant Byte** of the word is stored in the *Smallest address given*
**Least Significant Byte** of the word is stored in the *largest address given*

Little-Endian System:

**Most Significant Byte** of the word is stored in the *Largest address given*
**Most Significant Byte** of the word is stored in the *Smallest address given*

And what are these fancy looking words is just terms that describe the order in which a sequence of bytes are stored in computer memory.

Big-Endian System: Most Significant Byte in Smallest = 1 2 3 *Read as One-Hundred-Twenty-Three
Little-Endian System: Most Significant Byte in Largest = 1 2 3 *THREE-Hundred-Twenty-One*

Now, its get bit closer and how that work: For demonstration I'll use this table:

         *-------------*                    *-------------*
         |  Register   |                    |  Register   |
         *-------------*                    *-------------*
*--------* ▼  ▼  ▼  ▼  *           *--------*--▼--▼--▼--▼-*
|Memnory |0A 0B 0C  0D |           |Memnory | 0A 0B 0C 0D |
*--------*-------------*           *--------*--*--*--*--*-*
|        |                         |        |
*--------*                         *--------*
|a|      |                         |a|      |
*-*------*                         *-*------*
|a+1|    |                         |a+1|    |
*---*----*                         *---*----*
|a+2|    |                         |a+2|    |
*---*----*                         *---*----*
|a+3|    |                         |a+3|    |
*---*----*Big-Endian System:       *---*----*Little-Endian System:
Most Significant Byte in Smallest  Most Significant Byte in Largest

Now, Notice the below Diagram

         *-------------*                    *-------------*
         |  Register   |                    |  Register   |
         *-------------*                    *-------------*
*--------* ▼  ▼  ▼  ▼  *           *--------*--▼--▼--▼--▼-*
|Memnory |0A 0B 0C  0D |           |Memnory | 0A 0B 0C 0D |
*--------*-------------*           *--------*--*--*--*--*-*
|        | ▼  ▼  ▼  ▼              |        |  ▼  ▼  ▼  ▼ 
*--------* |  |  |  |              *--------*  |  |  |  | 
|a|    0A|<*  *  |  |              |a|    0 |<----------*
*-*------*    |  |  |              *-*------*  |  |  |
|a+1|  0B|<---*  |  |              |a+1|  0C|<-------*
*---*----*       |  |              *---*----*  |  |
|a+2|  0C|<------*  |              |a+2|  0B|<----*
*---*----*          |              *---*----*  |
|a+3|  0D|<---------*              |a+3|  0A|<-*
*---*----*Big-Endian System:       *---*----*Little-Endian System:
Most Significant Byte in Smallest  Most Significant Byte in Largest

Then, one might wonder how do we know if we are using Big/Little Endian ?

Now! Pay ATTENTION:

         *-------------*                    *-------------*
         |  Register   |                    |  Register   |
         *-------------*                    *-------------*
*--------* ▼  ▼  ▼  ▼  *           *--------*--▼--▼--▼--▼-*
|Memnory |01 02 03  04 |           |Memnory | 01 02 03  0 |
*--------*--*--*--*--*-*           *--------*--*--*--*--*-*
|        | ▼  ▼  ▼  ▼              |        |  ▼  ▼  ▼  ▼ 
*--------* |  |  |  |              *--------*  |  |  |  | 
|a|    01|<*  *  |  |              |a|    04|<----------*
*-*------*    |  |  |              *-*------*  |  |  |
|a+1|  02|<---*  |  |              |a+1|  03|<-------*
*---*----*       |  |              *---*----*  |  |
|a+2|  03|<------*  |              |a+2|  02|<----*
*---*----*          |              *---*----*  |
|a+3|  04|<---------*              |a+3|  01|<-*
*---*----*Big-Endian               *---*----*Little-Endian

Here Processing code:

import "unsafe"
fun main() {
 var x unit32 = 0x01020304
 switch *(*byte)(unsafe.Pointer(&x)) {  //Get the address of &x & convert to pointer. (*byte)(unsafe.Pointer(&x)) convert to (*byte) type NOTE: *(*byte)(unsafe.Pointer(&x)) [Dereference][15].
 case 0x01:
   println("Big Endian")
 case 0x04:
   println("Little Endian")
  }
}

You can try this on your now to see. My plan was for a brief approach to Endianness but oh well!

1
  • 1
    Don't forget network endianness. Where would the internet be if endianness wasn't specified.
    – munchkin
    Apr 4, 2015 at 4:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.