Reversing a hash function

Posted by martani_net on Stack Overflow See other posts from Stack Overflow or by martani_net
Published on 2010-12-24T00:46:55Z Indexed on 2010/12/24 0:53 UTC
Read the original article Hit count: 104

Filed under:
|

Hi,

I have the following hash function, and I'm trying to get my way to reverse it, so that I can find the key from a hashed value.

uint Hash(string s)
{
    uint result = 0;
    for (int i = 0; i < s.Length; i++)
    {
        result = ((result << 5) + result) + s[i];
    }
    return result;
}

The code is in C# but I assume it is clear.

I am aware that for one hashed value, there can be more than one key, but my intent is not to find them all, just one that satisfies the hash function suffices.

Any ideas? Thank you.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about hash