# to Hex, and back again?

Bang Head Here
09-10-2003, 10:58 AM
Hello. I am working on a small security feature where I would take a number between 8 and 10 digits, convert it to Hex and then convert it back again. The converting to Hex is fine, but how can I bring it back?

Example:
ConvertedNum = Hex(1234567890 / 1000)

But I'm not sure how I can then take the Hex value and turn it back into 1234567890. I can't do math on something like "52AAFE" so 52AAFE * 1000 is not valid.

Any help would be greatly appreciated!
Bryan

OnErr0r
09-10-2003, 10:59 AM
lNumber = CLng("&H" & sNumber)

Bang Head Here
09-10-2003, 11:19 AM
Thanks! My follow up for you is, if I have a 10 digit number...convert it to Hex like Hex(1234568790 / 1000)...is it possible to use your example to restore the full number?

I say that because I'm taking 5417729990 and converting to Hex like above and I get 52AB02. In converting it back, my number is 54717730. I'm looking for the number to come back the same for matching purposes.

Thanks Again!

reboot
09-10-2003, 11:22 AM
5417729990 is more than a Long can hold.

OnErr0r
09-10-2003, 11:25 AM
If you're interested in displaying very large hex numbers I've got a class written just for that purpose:

http://www.visualbasicforum.com/showpost.php?postid=467165&postcount=18

Bang Head Here
09-10-2003, 11:35 AM
Again, many thanks for your help on this.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum