Created
April 14, 2015 16:55
-
-
Save windytan/9ca6e92a4a932df90f8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <openssl/sha.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
const char target[SHA_DIGEST_LENGTH] = { | |
0x69, 0xaf, 0x88, 0x1e, 0xca, 0x98, 0xb7, 0x04, 0x2f, 0x18, | |
0xe9, 0x75, 0xe0, 0x0f, 0x9d, 0x49, 0xd5, 0xd5, 0xee, 0x64 | |
}; | |
unsigned char test_str[15]; | |
unsigned char test_hash[SHA_DIGEST_LENGTH]; | |
for (int k=0; k < 9999; k++) { | |
for (int tili=0; tili <= 999999; tili++) { | |
snprintf(test_str, 15, "3939%04d%06d", k, tili); | |
SHA1(test_str, 14, test_hash); | |
if (memcmp(test_hash, target, 20) == 0) { | |
printf("Vastaus: %s\n", test_str); | |
exit(0); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment