diff options
Diffstat (limited to 'set4/task26.c')
| -rw-r--r-- | set4/task26.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/set4/task26.c b/set4/task26.c new file mode 100644 index 0000000..5c7b047 --- /dev/null +++ b/set4/task26.c @@ -0,0 +1,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; +} |
