Commiting 2015/day04/day04.c for backup
This commit is contained in:
parent
de5c4ac25c
commit
57e8cd3a93
30
2015/day04/day04.c
Normal file
30
2015/day04/day04.c
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <openssl/md5.h>
|
||||||
|
|
||||||
|
void compute_md5(char *str, unsigned char digest[16]) {
|
||||||
|
MD5Context ctx;
|
||||||
|
MD5_Init(&ctx);
|
||||||
|
MD5_Update(&ctx, str, strlen(str));
|
||||||
|
MD5_Final(digest, &ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void part1() {
|
||||||
|
unsigned char digest[16];
|
||||||
|
compute_md5("asdf", digest);
|
||||||
|
}
|
||||||
|
|
||||||
|
void part2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
int doPart = 1;
|
||||||
|
if(argc > 1) { doPart = argv[1][0] - '0'; }
|
||||||
|
if(doPart == 1) {
|
||||||
|
part1();
|
||||||
|
} else {
|
||||||
|
part2();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user