views:

169

answers:

3

I'm a little confused here:

I'm trying to reverse engineer the ASCII value 65. In the book I am reading it says:

Decimal: 65
Hex:  41
Octal: 101

But 65 in its binary representation is:

0010 0001

And 0010 in hex is 2, while 0001 is 1, which indicates that the hex value "should" be: 21.

Where did I go wrong?

+5  A: 

65 dec in bin is 0100 0001.

Jan Aagaard
This right here is the answer. 0010 0001 is actually 33, not 65.
John Rudy
@John: Yeah, but mrblah is also believes that the first four digits represent the first digits in the hex number.
Jan Aagaard
um, thats how you do bin to hex (at least in an ad hoc way) - its easy cos hex is a power of 2 so you have a fixed number of bits for each hex char
jk
assuming your binary is padded to nibble boundaries of course, which is true in this case
jk
Thanks for pointing this out, jk. I edited my answer.
Jan Aagaard
+4  A: 

you have the binary wrong - it should be 0100 0001 - your bin to hex is fine

incidentally bin->oct->dec->hex is one of the things calc.exe is actually really useful for

jk
Especially in calc's Win7 incarnation.
John Rudy
+1  A: 

65 in decimal is:

 0100 0001

You're off by a digit in the first nibble.

richardtallent