Created
July 31, 2017 19:28
-
-
Save FauxFaux/55c96cefe170a42bc134dff71516b13d to your computer and use it in GitHub Desktop.
This file contains 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
// gcc -Wall -Wextra -O2 guess.c -lcrypto -o guess | |
#include <openssl/des.h> | |
#include <stdint.h> | |
#include <string.h> | |
int main() { | |
DES_cblock key_data; | |
if (!DES_random_key(&key_data)) { | |
printf("couldn't generate random key"); | |
return 1; | |
} | |
for (uint64_t t = 0; t < 100 * 1000 * 1000; ++t) { | |
memcpy(key_data, &t, 8); | |
DES_key_schedule ks; | |
DES_set_key(&key_data, &ks); | |
const_DES_cblock in = {}; | |
DES_cblock out; | |
DES_ecb_encrypt(&in, &out, &ks, DES_ENCRYPT); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment