Permalink
Browse files

Now receives the key as a parameter

  • Loading branch information...
1 parent 81a84c1 commit aad774c5d6950f606f05eb969a13bdeb6fc4f286 @tcpip4000 committed Dec 29, 2008
Showing with 8 additions and 13 deletions.
  1. +2 −2 libcrypter/crypter.c
  2. +6 −11 modaler.c
View
@@ -169,6 +169,6 @@ void encryptDecryptTest(gcry_cipher_hd_t hd, char *plain_filename)
void fillCharVectorWithSpaces(unsigned char vector[], int len)
{
- for (int i=0; i < len; i++)
- vector[i] = ' ';
+ for (int i=0; i < len; i++)
+ vector[i] = ' ';
}
View
@@ -11,8 +11,8 @@ int main(int argc, const char *argv[])
{
const char *libgcrypt_version = gcry_check_version(GCRYPT_VERSION);
gcry_error_t err = 0;
- char key[32];
- //char *key;
+ //char key[32];
+ char *key;
int keylen;
int algo = GCRY_CIPHER_SERPENT128;
@@ -21,22 +21,17 @@ int main(int argc, const char *argv[])
//char filename[] = "files/modal.erc";
//char filename2[] = "files/modal_out.erc";
//char filename3[] = "files/modal_enc.erc";
- memcpy(key, "0123456789abcdef.,;/[]{}-=ABCDEF", 32);
+ //memcpy(key, "0123456789abcdef.,;/[]{}-=ABCDEF", 32);
- if (argc != 4) {
+ if (argc != 5) {
printf("Wrong parameter quantity\n");
exit(1);
}
filename = argv[1];
filename2 = argv[2];
filename3 = argv[3];
- //key = argv[1];
- //int i;
- //for (i = 0; i < argc; i++) {
- // printf( "arg %d: %s\n", i, argv[i] );
- //}
-
+ key = argv[4];
// cipher initialization
if (!libgcrypt_version) {
@@ -61,7 +56,7 @@ int main(int argc, const char *argv[])
//gcry_cipher_setiv
//decryptFile(hd, filename);
- encryptDecryptTest(hd, filename);
+ //encryptDecryptTest(hd, filename);
encryptFileToFile(hd, filename, filename2);
decryptFileToFile(hd, filename2, filename3);

0 comments on commit aad774c

Please sign in to comment.