Skip to content

Instantly share code, notes, and snippets.

@modz2014
Created December 30, 2021 17:12
Show Gist options
  • Save modz2014/a0b50a00cbd517fb3c448b9e923e9941 to your computer and use it in GitHub Desktop.
Save modz2014/a0b50a00cbd517fb3c448b9e923e9941 to your computer and use it in GitHub Desktop.
unsigned int data[] =
{
//data goes here in hex
unsigned int get-hash1 (char *name)
{
unsigned int hash = 0;
char *p = name + 3;
int i = 0;
while (*p)
{
unsigned int temp = (unsigned int)*p;
temp *= data [i];
hash += temp;
i++;
if (i > 0x26) i = 0;
p++;
}
return hash;
}
unsigned int get-hash2 (char *name)
{
unsigned int hash = 0;
char *p = name + 3;
int i = 0;
while (*p)
{
unsigned int temp = (unsigned int)*p;
temp *= (unsigned int)*(p-1);
temp *= data [i];
hash += temp;
i++;
if (i > 0x26) i = 0;
p++;
}
return hash;
}
int main (int argc, char *argv[])
{
unsigned int hash1 = get_hash1 (argv[1]);
unsigned int hash2 = get_hash2 (argv[1]);
printf ("%u-%u\n", hash1, hash2);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment