36 lines
936 B
C
36 lines
936 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "cherry.h"
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
const int size = 1028;
|
|
char cherry[size], cherry2[size], crystal[size], crystal2[size];
|
|
int mask[size], mask2[size], i;
|
|
int length = 0;
|
|
puts("Enter the Cherry: ");
|
|
fgets(cherry, size, stdin);
|
|
puts("Enter the Crystal: ");
|
|
fgets(crystal, size, stdin);
|
|
cherry_encrypt(cherry, crystal, mask);
|
|
for (i = 0; i < strlen(crystal) - 1; i++) {
|
|
printf("%d ", mask[i]);
|
|
length++;
|
|
}
|
|
printf("\nYour mask is : %d characters long", length);
|
|
puts("\n===Decryption: ===\n");
|
|
puts("Enter the Cherry: ");
|
|
fgets(cherry2, size, stdin);
|
|
puts("Enter the size of the Mask: ");
|
|
scanf("%d", &length);
|
|
puts("Enter the mask: ");
|
|
for (i = 0; i < length; i++) {
|
|
scanf("%d", &mask2[i]);
|
|
}
|
|
puts("The Crystal is: ");
|
|
cherry_decrypt(cherry2, crystal2, mask2, length);
|
|
puts(crystal2);
|
|
return 0;
|
|
}
|