Converting hexadecimal to binary

nickk

Solid State Member
Messages
7
Hi,

I have an urgent problem. I am using this website: http://www.fourmilab.ch/hotbits/generate.html to generate random numbers for some tests. The application I am using to carry out these tests only accepts binary input (the second checkbox at the website, "Binary download to a file"), but I have made a special request for extra data, which he provided in hex form (the first checkbox) now I need a way to convert it from hex to decimal, keep in mind the files are big, 16 mb of random data. I can post screenshots of how they look in a hex editor. Any help appreciated.

Thanks, Nick
 
Are you asking to convert from hex to decible, you count up to 16 using numbers and letters just like you could to number ten using numbers only.

Example
Decimal for 1st 16 values (up to 15)
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15

Hex for the 1st 16values (up to 15)
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f

Like decimal, hex uses can use more than one digit. example.

20 in decimal is simply that, 20. In hex it is 14. The 1 digit in 10 standing for the hex value of 16 plus the second digit 4 standing for 4. i.e. Hex works in powers of 16. Decimal in 10's and Binary in 2's.

To convert Decimal to binary, things go up in powers of 2's. 0001 is 4 bit binary for 1. 0010 is 2, 0011 is 3 and soforth. to convert from hex to binary, split the hex value into it's individual digits, and for each digit, work out the 4bit binary equivilent then add the 4bit blocks of binary together relative to the hex digits they were made from. example.

Hex value 3D1 in decimal is 977.

to convert to binary, 3 in hex is 3 in decimal so in 4 bit binary is 0011.

D in hex is 13 in decimal and is 1101 in binary.

1 in hex is 1 in decimal and is 0001 in binary.

add these 4 bit blocks together and you get 0011 1101 0001

Hence 3D1 hex = 001111010001 Binary.

Work it in reverse if needed.

You could just use Windows Calculator too.
 
That would take a very, very long time to do with a file that size, though. I imagine he's asking about a program that can do it. I don't know of one offhand, but you might be able to find something like it at www.download.com or just search Google.
 
Thank for the replies
Connchri: Doing an 11 mb file by hand would take more time than I have :)
Spank_fusion: I couldint really find an application that does this.
Check out the following 2 screenshots. The first one is the format that its meant to be in, the "binary download" from the website:
http://img389.imageshack.us/my.php?image=binary1bn.jpg
The following one is the format I have it in, the hex format:
http://img389.imageshack.us/my.php?image=hex6sr.jpg

I would appreciate any help, because now it needs to get done VERY soon
 
Back
Top Bottom