-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.c
85 lines (70 loc) · 1.57 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
main - done
encrypt - done
decrypt - done
explain - done
header - done
makefile - figure out how to write
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "header.h"
#include <conio.h>
int main()
{
int choice;
printf("Welcome to Vigenere Cipher");
do
{
printf("\n\nEnter your choice: \n");
printf("1 - What is Vigenere Cipher (Help menu) \n");
printf("2 - Encryption \n");
printf("3 - Decryption \n");
printf("4 - File Encryption \n");
printf("5 - File Decryption \n");
printf("6 - Exit \n");
scanf("%d", &choice);
char plaintext[50], key[50], encrypt[50];
switch (choice)
{
case 1:
explain();
break;
case 2:
printf("Enter the plaintext (text to be encrypted) \n");
scanf("%s", plaintext);
printf("Enter the key \n");
scanf("%s", key);
strupr(plaintext);
strupr(key);
encryption(plaintext, key);
break;
case 3:
printf("Enter the encrypted text \n");
scanf("%s", encrypt);
printf("Enter the key\n");
scanf("%s", key);
strupr(encrypt);
strupr(key);
decryption(encrypt, key);
break;
case 4:
printf("Enter the key to encrypt the file\n");
scanf("%s", key);
file_encryption(key);
break;
case 5:
printf("Enter the key to decrypt the file\n");
scanf("%s", key);
file_decryption(key);
break;
case 6:
exit(0);
default:
printf("Invalid Output. Please try again. \n");
break;
}
} while (choice != 6);
return 0;
}