This commit is contained in:
2025-11-11 23:03:58 +00:00
parent a642f6d891
commit 27aad6b738
3 changed files with 45 additions and 1 deletions

5
2015_day_4/Makefile Normal file
View File

@@ -0,0 +1,5 @@
compile:
gcc day4.c -Werror=switch -o day4 -lcrypto
run:
./day4

View File

@@ -10,3 +10,9 @@ For example:
If your secret key is pqrstuv, the lowest number it combines with to make an MD5 hash starting with five zeroes is 1048970; that is, the MD5 hash of pqrstuv1048970 looks like 000006136ef....
Your puzzle input is yzbqklnj.
I'm going to use the RFC 1321 library here, as designing an md5 implementation is a bit too much for right now
Correction, I will use the old style openssl/md5.h

33
2015_day_4/day4.c Normal file
View File

@@ -0,0 +1,33 @@
#include <openssl/md5.h>
#include <stdio.h>
#include <string.h>
int main(){
printf("\nWEST");
const char *input_string = "yzbqklnj";
unsigned char output_digest[MD5_DIGEST_LENGTH];
unsigned long long int iteration_number = 0;
//creating empty md5 context
MD5_CTX context;
zeroes = {0,0,0,0,0}
//comparing first 5 digits of output
while (memcmp(charx, zeros, 5) !=0){
if(!MD5_Init(&context)){
fprintf(stderr,"Error MD5init failed");
return 1;
}
//suffix generation
if(iteration_number !=0){
suffix = iteration_number +1;
}
suffix =
}
}
//input = yzbqklnj