Skip to content

Instantly share code, notes, and snippets.

@hmic
Created January 25, 2012 22:35
Show Gist options
  • Save hmic/1679312 to your computer and use it in GitHub Desktop.
Save hmic/1679312 to your computer and use it in GitHub Desktop.
for( i = 0; i < MAX_STRING_LEN; i++ ) {
bk = 0;
in[0] = 0;
for( n = i; n >= 0; n-- ) {
in[n] = 1;
}
len = strlen(in);
for( j = len; j >= 0; j-- ) {
for( n = 1; n < 255; n++ ) {
in[j] = n;
strncpy(out, in, len);
// encode(in, out, len, 76);
hash = hash_func(in, len);
printf("0x%llx %s\r\n", hash, out);
fprintf(fp, "0x%llx %s\r\n", hash, out);
}
for( k = len; k >= 0; k-- ) {
if( in[k] == 255 ) {
in[k] = 1;
if( k > 0 ) {
l = k - 1;
in[l] = in[l] + 1;
j = len + 1;
} else {
bk = 1;
break;
}
}
}
if(bk) break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment