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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.