Skip to content

Commit 17a4679

Browse files
committedMar 12, 2018
Testing confidentiality and integrity functions
1 parent 9e489fd commit 17a4679

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎room1/test.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdio.h>
2+
#include <string.h>
3+
#include "challenge_response.h"
4+
5+
int main() {
6+
int i;
7+
char *hash_inp[3] = {"132|31", "0", "123456789"};
8+
long hash_exp[3] = {33331376034, 173811, 18429362615268};
9+
for(i = 0; i < 3; i++) {
10+
printf("Hash of %s Expected: %ld Actual: %ld\n",hash_inp[i], hash_exp[i], gen_hash(hash_inp[i]));
11+
}
12+
char enc_inp[3] = {'5', '0', '9'};
13+
char dec_inp[3] = {'8', '3', '2'};
14+
for(i = 0; i < 3; i++) {
15+
printf("Encrytion of %c Expected: %c Actual: %c\n", enc_inp[i], dec_inp[i], encrypt(enc_inp[i]));
16+
}
17+
18+
for(i = 0; i < 3; i++) {
19+
printf("Decryption of %c Expected: %c Actual: %c\n",dec_inp[i], enc_inp[i], decrypt(dec_inp[i]));
20+
}
21+
return 0;
22+
}

0 commit comments

Comments
 (0)
Please sign in to comment.