Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Reaped: Converting a number back to it's original string (that was hashed to generate that number)

by NodeReaper (Curate)
on Jan 23, 2013 at 13:17 UTC ( #1014898=perlquestion: print w/replies, xml ) Need Help??

NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Reaped: Converting a number back to it's original string (that was hashed to generate that number)

Replies are listed 'Best First'.
Re: Converting a number back to it's original string (that was hashed to generate that number)
by marto (Cardinal) on Jan 23, 2013 at 13:22 UTC
Re: Converting a number back to it's original string (that was hashed to generate that number)
by roboticus (Chancellor) on Jan 23, 2013 at 13:28 UTC

    Nik:

    How many different strings do you want to convert back and forth? For a 5 digit number, the maximum possible set of strings that you could map back and forth is under a million. It's a pretty straightforward result of the Pigeonhole Principle.

    So if you want to do this, you're going to have to come up with rules to constrain your set of input strings to a set small enough to fit in the number of pigeonholes you have. *AND* you'll have to come up with a unique mapping between those strings and the numbers. (You, not us.)

    The instant you have the possibility of mapping two different strings into the same number, you have lost information, and can no longer tell the two strings apart from the number. There's no way to reliably know which string to map the number to without some other source of information.

    roboticus

    Sorry for the troll food.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Converting a number back to it's original string (that was hashed to generate that number)
by Anonymous Monk on Jan 23, 2013 at 13:19 UTC
    This is Python, not Perl. This site is Perlmonks. Also this can't be done.
Re: Converting a number back to it's original string (that was hashed to generate that number)
by Anonymous Monk on Jan 23, 2013 at 13:23 UTC
    Reap this thread, and don't reply further.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1014898]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2021-10-18 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (75 votes). Check out past polls.

    Notices?