From d237911c2089a2645624bdfc98fc979beabea875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nut=CC=A6iu?= Date: Sat, 16 Apr 2016 00:49:31 +0300 Subject: [PATCH] Polishing last changes --- lab8/1.c | 23 ++++++----------------- lab8/libcipher.a | Bin 1416 -> 1416 bytes 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/lab8/1.c b/lab8/1.c index 46fa0fe..3e8771c 100755 --- a/lab8/1.c +++ b/lab8/1.c @@ -44,7 +44,7 @@ void encrypt_file(char * filename, u8 * password) { } fwrite(buffer, sizeof(u8), read, out); - // printf("%s\n", buffer); + printf("%s\n", buffer); if ( fclose(in) || fclose(out) ) { perror("Error closing files!"); } @@ -65,7 +65,7 @@ void decrypt_file(char * filename, u8 * password) { } fwrite(buffer, sizeof(u8), read, out); - // printf("%s\n", buffer); + printf("%s\n", buffer); if ( fclose(in) || fclose(out) ) { perror("Error closing files!"); } @@ -80,6 +80,10 @@ int main (int argc, char *argv[]) { } char * password = argv[2]; + if (strlen(password) < 12) { + perror("Password must be at least 12 characters long!"); + return 0; + } u8 inputKey[strlen(password) - 1]; int i = 0; for (; password[i]; i++) { @@ -94,21 +98,6 @@ int main (int argc, char *argv[]) { } else { decrypt_file(argv[1], keys); } -// u8 inputKey[] = {"test"}; -// u8 keys[SPECK_BLOCK_SIZE/16*SPECK_ROUNDS]; -// // plain text: 74614620 736e6165 -// u8 plainText[] = "ana are mere, foarte multe mere, atat de multe incat nu mai poate"; -// -// encryptKeySchedule(inputKey, keys); -// -// printf("PlainText: %s\n", plainText); -// -// encrypt(plainText+8, keys); -// // cipher text: 9f7952ec 4175946c -// printf("After encryption: %s\n", plainText); -// -// decrypt(plainText+8, keys); -// printf("After decryption: %s\n", plainText); return 0; } diff --git a/lab8/libcipher.a b/lab8/libcipher.a index 021afceca9417a6dd0768c4db9585de1c1976db1..e04368035dcc38b41a50cf4504a4096ef8271f9d 100644 GIT binary patch delta 21 ccmeC+?%