Brute force should work if uint is 32 bits. Try at least 2 ^ 32 lines, and one of them will most likely have a hash value with the same value. It only takes a few minutes on a modern PC.
You have 12 possible characters, and 12 ^ 9 is about 2 ^ 32, so if you try 9 characters, you will most likely find your target hash. I will do 10 characters to be safe.
(simple recursive implementation in C ++, I don't know C #, which is good)
#define NUM_VALID_CHARS 12 #define STRING_LENGTH 10 const char valid_chars[NUM_VALID_CHARS] = {'0', ..., '#' ,'*'}; void unhash(uint hash_value, char *string, int nchars) { if (nchars == STRING_LENGTH) { string[STRING_LENGTH] = 0; if (Hash(string) == hash_value) { printf("%s\n", string); } } else { for (int i = 0; i < NUM_VALID_CHARS; i++) { string[nchars] = valid_chars[i]; unhash(hash_value, string, nchars + 1); } } }
Then name it with
char string[STRING_LENGTH + 1]; unhash(hash_value, string, 0);
Keith randall
source share