-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenigma_driver.c
30 lines (23 loc) · 976 Bytes
/
enigma_driver.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 "enigma.h"
int main() {
char message[80];
char encrypted_message[80];
char decrypted_message[80];
char which_rotors[5];
char encryption_rotors[4][27];
int rotations;
int num_active_rotors;
printf("Enter the message to be encrypted or decrypted: ");
Get_Message(message);
printf("\nWhich rotors will be used to encrypt the message: ");
num_active_rotors = Get_Which_Rotors(which_rotors);
printf("\nEnter the number of rotations to apply to the encryption rotors: ");
rotations = Get_Rotations();
Set_Up_Rotors(encryption_rotors, which_rotors);
Apply_Rotation(rotations, encryption_rotors);
Encrypt(encryption_rotors, num_active_rotors, message, encrypted_message);
Decrypt(encryption_rotors, num_active_rotors, encrypted_message, decrypted_message);
printf("The encrypted message is: %s", encrypted_message);
printf("The decrypted message is: %s", decrypted_message);
return 0;
}