Can I get the original string from a HashCode?
-
Hello!! Can I get the original string from a HashCode? I mean, do the reverse action of GetHashCode. thanks :confused: Scan files and folders for viruses from your .Net applications - Click here!
I don't think that's possible. The hash code simply could not be unique enough to support all possible strings. If you want to store string and hash code pairs, use a System.Collections.Generic.Dictionary<int, string> to store them together. You can then easily retrieve strings via dictionary[hashCode].
-
I don't think that's possible. The hash code simply could not be unique enough to support all possible strings. If you want to store string and hash code pairs, use a System.Collections.Generic.Dictionary<int, string> to store them together. You can then easily retrieve strings via dictionary[hashCode].
-
Hello!! Can I get the original string from a HashCode? I mean, do the reverse action of GetHashCode. thanks :confused: Scan files and folders for viruses from your .Net applications - Click here!
-
It's totally not possible. The hashing function is always one way. Since int can only have about 2.2B possible values, there is way more than 2.2B possible string combinations.
Yep, my thoughts exactly.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: How 'bout a little guitar now? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango