I have the hashcode of a string, and now I want to get the original string back. Is there any method available for this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is no such method. The hash function is lossy.
When you think about it, the set of all possible strings is much larger than the set of all possible ints, making a two-way mapping impossible.
If it were possible to recover the string from its hash code, that would enable one to compress an arbitrary amount of data into a single
int, and then to be able to perfectly reconstruct it.