PDA

View Full Version : Not sure if I understand this - Networking - bits, bytes, etc.




slooksterPSV
Aug 2, 2006, 11:10 AM
Ok I'm not sure I understand this, though it makes sense in my mind and I don't want to get this wrong.

If I have a key that is hexadecimal its a 16-bit's right? 0-F right?
If I have a key that takes 5 pairs of hexadecimal bits its 10-bits right? AB CD EF GH IJ
Now if I have a 64-bit encryption it takes the 5 pairs of hexadecimal bits right? so 2^5 = 32 bytes, so its a 32 byte word or character string is what I'm meaning. Now when it encrypts that word to a 64-bit encryption it does (in programming terms) this, it bit shifts the 32 byte word 63 places right. e.g.

wordtwo = word << 63

That's what makes the 64-bit encryption, correct? But it does it to each individual character, correct? But it may be in an algorithm to mix up the letters and to add a key value and mix in the key value correct?

I need to make sure I have this down, cause it makes sense to me, but I'm not sure if its right or wrong.



plinden
Aug 2, 2006, 11:26 AM
I'm not quite sure what you're asking, but a hexadecimal number (can't say "digit") is 4 bits, e.g. F = 1111.

A byte is represented by two hex numbers, e.g. A9 = 1010 1001.

So five pairs of hexes is 5 bytes or 40 bits.

On the other hand, if you're talking about characters rather than the actual hex representation of the value, each ASCII character is 8 bits, so five pairs of characters is 10 bytes or 80 bits. UTF-8 characters can be between 1 and 4 bytes, or 8-32 bits.

robbieduncan
Aug 2, 2006, 11:27 AM
A single hexidecimal value is 4-bits (which is 0.5 bytes). This can be represented as a single character [0-9,A-F], but one should not confuse the display of the character with the value (as an ASCII character is 8 bits)

A pair of hexidecimal values can represent 256 (0-255) values, which is a single byte (or 8 bits). So 5 pairs of hex digits = 5 bytes = 40 bits.

A 64 bit value would require 8 bytes or 16 hex values.

ChrisBrightwell
Aug 2, 2006, 11:32 AM
A single hexidecimal value is 4-bits (which is 0.5 bytes). Also defined as a "nibble." Seriously.

robbieduncan
Aug 2, 2006, 11:43 AM
Also defined as a "nibble." Seriously.

It's true. I was taught that term at school many moons ago!

slooksterPSV
Aug 2, 2006, 12:27 PM
Perfect! thanx you guys, now its time to go post another problem in a thread

GeeYouEye
Aug 2, 2006, 01:06 PM
Bit-shifting a 32 bit number 63 places in either direction will result in a totally zeroed number, ie

t = 123456;
t = t << 63;
printf(t);

would print "0".

slooksterPSV
Aug 2, 2006, 01:09 PM
Bit-shifting a 32 bit number 63 places in either direction will result in a totally zeroed number, ie

t = 123456;
t = t << 63;
printf(t);

would print "0".
Oh duh, that's right, how they explained it was perfect so yeah.