Jump to content

Using arcfour (RC4) cipher with mcrypt extension


Recommended Posts

hello,

 

I need to encrypt data using the RC4 encryption. I already installed mcrypt and it works for ciphers such as MCRYPT_RC2 and MCRYPT_RIJNDAEL_128.

 

Running phpinfo() gives me the following:

 

Supported ciphers: cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes

 

That's probably why I can't use ARCFOUR. But it does say in the manual that arcfour is included in libmcrypt > 2.4.x.

http://de.php.net/manual/en/mcrypt.ciphers.php

 

I'm running Version 2.5.7 and Api No 20021217.

 

I also saw that there is a arcfour.h and arcfour.c file in the algorithms folder. So why aren't they recognized?

 

Thanks for any help. I really need to make this encryption work.

 

And here is the code I'm using to run it:

 

$td = mcrypt_module_open(MCRYPT_ARCFOUR, '',      MCRYPT_MODE_NOFB, '');

$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size ($td), MCRYPT_DEV_RANDOM); 
                
$initReturn = mcrypt_generic_init($td, $passphrase, $iv);
                
$bufferrc4 = mcrypt_generic( $td  , $bufferAsString);

mcrypt_generic_deinit($td);

mcrypt_module_close($td);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.