summaryrefslogtreecommitdiff
path: root/set4/task26.c
blob: 5c7b04746e0a6b5fc84ab105139bbab5f06dd44d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "../lib/lib.h"
#include "../lib/lib2.h"
#include "../lib/lib3.h"
#include "../lib/lib4.h"
#include <time.h>


int main()
{
	generate_random_bytes(key, 16);
	generate_random_bytes(iv, 16);

	char *encrypted;
	int length_enc = challenge16_encrypt(":admin<true:", &encrypted, 0);

	char *plaintext;
	printf("the unchanged string:\n%s\n", plaintext);
	challenge16_decrypt(encrypted, length_enc, 0);
	/**
	  * the encrpyt function prepends two blocks
	  * 
	  * we need to flip three bits, the 8th bit, 56th bit and the
	  * 96th bit
	  */
	encrypted[32] ^= 0x01;
	encrypted[38] ^= 0x01;
	encrypted[43] ^= 0x01;

	printf("now the changed string:\n");
	challenge16_decrypt(encrypted, length_enc, 0);
	return 0;
}