-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
30 lines (21 loc) · 805 Bytes
/
main.c
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
#include <stdio.h>
#include <string.h>
#include "rc4.h"
int main() {
char* key = "hello world";
int keylength = 11;
struct RC4_State* state1 = new_rc4_state(key, keylength);
struct RC4_State* state2 = new_rc4_state(key, keylength);
struct RC4_State* state3 = new_rc4_state(key, keylength);
char* plaintext = malloc(22 * sizeof(char));
strcpy(plaintext, "THIS IS THE PLAINTEXT\n");
char* ciphertext = malloc(22 * sizeof(char));
strcpy(ciphertext, "THIS IS THE PLAINTEXT\n");
char* decrypted = malloc(22 * sizeof(char));
strcpy(decrypted, "THIS IS THE PLAINTEXT\n");
encrypt(state1, ciphertext, 22);
encrypt(state2, decrypted, 22);
encrypt(state3, decrypted, 22);
printf("%s\n%s\n%s\n", plaintext, ciphertext, decrypted);
return 0;
}