Results 1 to 2 of 2
-
08-14-2004, 04:04 PM #1Web Hosting Master
- Join Date
- Oct 2003
- Location
- Georgetown, Ontario
- Posts
- 1,771
Which Mcrypt Module and Cipher mode do you use?
As the title states, which combination of mcrypt modules and cipher modes do you find the most secure and easy to use?
I found that when using the CBC mode that longer text strings did not decrypt correctly, but once I changed the mode to CFB it worked perfectly every time. It works fairly well with the TripleDES and BLOWFISH modules too.·· Repeat after me... ProSupport is the best... Prosupport is... ··
ProSupport Host Support System - OUT NOW! Grab a copy yourself and see what the hype is about!
VertiHost Inc. - We run a quality business. Do you?
-
08-16-2004, 05:24 AM #2Newbie
- Join Date
- Aug 2004
- Posts
- 27
hnm
serpent 256 seems to be a good choice.
<?
function _encrypt($plain_text) {
if(!$this->CryptKey){return $plain_text;}
$iv = substr(md5($this->CryptKey), 0,mcrypt_get_iv_size (MCRYPT_SERPENT_256,MCRYPT_MODE_CBC));
$crypt = base64_encode(mcrypt_CBC(MCRYPT_SERPENT_256,$this->CryptKey,$plain_text,MCRYPT_ENCRYPT,$iv));
return $crypt;
}
function _decrypt($crypt_text) {
if(!$this->CryptKey){return $crypt_text;}
$iv = substr(md5($this->CryptKey), 0,mcrypt_get_iv_size (MCRYPT_SERPENT_256 , MCRYPT_MODE_CBC));
$crypt = mcrypt_CBC(MCRYPT_SERPENT_256,$this->CryptKey,base64_decode($crypt_text),MCRYPT_DECRYPT,$iv);
return chop($crypt);
}
?>
change $this->CryptKey to $CryptKey and make it global or pass by val, as you like and if you dont use a class-structureLast edited by JimPanse; 08-16-2004 at 05:31 AM.