Click to See Complete Forum and Search --> : encode/decode. Driving me insane


bf51ux
March 11th, 2010, 07:59 PM
Hello everyone, I know i have asked this before, but i still cant figure it out and i will end up cracking up!

OK,

string input = ("34545-87632-09087-34544-98766-00989-34323-89887-32");


The above string is a 41-digit decimal number entered into a text box by the user.

now how do i do the following...?


A decimal number of this length roughly corresponds to a 136-bit binary
number. In fact, the 41-digit number is just the decimal encoding of
such a 136-bit multi-precision integer, which is stored in little
endian byte order as a byte array. Hence, the above Installation ID
can also be represented as a sequence of 17 bytes as in

0xXX 0xXX 0xXX 0xXX 0xXX 0xXX 0xXX 0xXX
0x94 0xAA 0x46 0xD6 0x0F 0xBD 0x2C 0xC8
0x00

So, how do i get the 41 digit string into its 17 byte array, however...

1) Not just a byte representation, where i end up with 41 bytes.

2) I know it involves binary or bit math, but i havent got a clue

Could someone please show me how to encode and decode as above, and i will be eternaly gratefull.

Thank you
Steve