|laziness, impatience, and hubris|
Re^2: Converting a number back to it's original string (that was hashed to generate that number)by Nik
|on Jan 23, 2013 at 13:44 UTC||Need Help??|
The number of the .html pages are < 100.
Please DON'T tell me to save both the pin <=> filepath and associate them (that can be done by SQL commands, i know)
I will not create any kind of primary/unique keys to the database.
I will not store the filepath into the database, just the number which indicates the filepath(html page).
Also no external table associating fielpaths and numbers.
i want this to be solved only by Python Code, not database oriented.
That is: I need to be able to map both ways, in a one to one relation, 5-digit-integer <=> string
int( hex ( string ) ) can encode a string to a number. Can this be decoded back? I gues that can also be decoded-converted back because its not losing any information. Its encoding, not compressing.
But it's the % modulo that breaks the forth/back association.
So, the question is:
HOW to map both ways, in a one to one relation, (5-digit-integer <=> string) without losing any information?