Skip to content

Instantly share code, notes, and snippets.

@windytan
Created Apr 14, 2015
Embed
What would you like to do?
#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