What size should i use in encrypt/decrypt in ARC4 ?

Jabka Atu mashrom.head at gmail.com
Wed Jul 30 14:42:30 CEST 2008


Howdy ,..

I cannot understand what values i should use in encrypt /decrypt when using
gcry_cipher_encrypt :

for example when i run this code :

 char * plain_text = "Attack at down";
 char * c_str ;
 c_str = new char[ strlen(plain_text) + 1  ];
 strcpy ( c_str, plain_text);

gcry_check_version(NULL)
gcry_control( GCRYCTL_DISABLE_SECMEM_WARN );
gcry_control( GCRYCTL_INIT_SECMEM, 16384, 0 );
gcry_cipher_open (&cipher_handler,
GCRY_CIPHER_ARCFOUR,GCRY_CIPHER_MODE_STREAM, 0);
gcry_cipher_setkey (cipher_handler,"Secret", 128);

gcry_cipher_encrypt (cipher_handler,c_str,strlen(c_str) , NULL,0);
cout<<c_str<<endl;

gcry_cipher_decrypt (cipher_handler, c_str,strlen(c_str),NULL,0);
cout<<c_str<<" " <<endl;

i get the next output :

��g�zB�QK]o
��A�R����       2�9�


while i should get :

45A01F645FC35B383552544B9BF5
Attack at down

What values should i use in sizes (since i guess i made there some error .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20080730/9e5cf3ab/attachment.htm>


More information about the Gcrypt-devel mailing list