Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to compress a large number into a Smaller number

Status
Not open for further replies.

godonga

Technical User
Mar 19, 2006
25
ZA
Hi
This question may sound wierd but I really need you help. I need to come up with a program that takes in at least a 16 digit number and outputs say a 6 digit number. I should be able to do the reverse as well i.e. put in the 6 digit number and output the exact 16 digit number.

Any ideas?

G
 
Compress? Is it possible to compress 12345678 to 6-digit number?
May be input or output numbers with fixed precision?
Please, pose a question with sufficient precision...
 
16 decimal digits is appx 53 bits. Say 54 bits. If we divide that by 6, we get 9 so each digit is 9 bits i.e. it has a range of 0..511.

If you take a base 512 number similar to what they do in uuencode, you should be able to get it into 6 base 512 numbers. All you have to figure out is which characters to use to represent 0..511.
 
54 == 6*9; to represent 0..511 we need 9 bits...
Or funny compress method?...
I suspect it was a question about proper format specifications or stream manipulators. May be I'm wrong...
 
Thanks guys for all your input. The logic of this would be to have something like a failed implementation of MD5 where one can get the original number from the hash message. the following is an example of what I am looking for


12345678912345678919 --> f(x) --> 234679

37677772399998633091 --> f(x) --> 346723

234679 --> f(x) --> 12345678912345678919

346723 --> f(x) --> 37677772399998633091

The resultant must'nt be limited to an Integer , it can be anything as long as it be reconverted to Integer in the reverse.

Your thoughts???
 
Hashing is different. It is based on a few slots and a wide range of numbers, knowing full well that all the slots will never be filled and all the numbers will never be requested.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top