From 9dcc7348ad53cab8fd9396699de0177bac6729d5 Mon Sep 17 00:00:00 2001 From: Benedict Date: Tue, 31 Jan 2017 22:45:22 +0100 Subject: set7: task52: completed --- set7/task52.c | 248 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 set7/task52.c (limited to 'set7') diff --git a/set7/task52.c b/set7/task52.c new file mode 100644 index 0000000..aba8445 --- /dev/null +++ b/set7/task52.c @@ -0,0 +1,248 @@ +#include "../lib/lib.h" +#include "../lib/lib2.h" +#include "../lib/lib3.h" +#include "../lib/lib4.h" +#include "../lib/lib5.h" +#include "../lib/lib7.h" + +/** + * MD-Hash implementation with AES-128. Outputs only 2^16 bits of the hash + **/ +void md_hash_aes_128(char *input, int input_len, char *state, char *hash, int bytes, int print) +{ + int blocksize = 16; + int i; + int pad_len; + char h[blocksize]; + char key[blocksize]; + char h_hex[32]; + char *input_padded = __pkcs7_padding(input, input_len, 16, &pad_len); + + // set the intial state + memset(h, 0, blocksize); + memcpy(h, state, bytes); + if(print == 1) + printf("input len is: %i, in blocks: %i\n", input_len, input_len/blocksize); + + for(i=0;i