Skip to content
Snippets Groups Projects
Commit 75617f53 authored by Peter Rotich's avatar Peter Rotich
Browse files

Remove unused mcrypt helper function -> use class.mcrypt.php instead

parent f333f8e9
No related branches found
No related tags found
No related merge requests found
......@@ -29,27 +29,6 @@ class Misc {
return mt_rand($start,$end);
}
function encrypt($text, $salt) {
//if mcrypt extension is not installed--simply return unencryted text and log a warning.
if(!function_exists('mcrypt_encrypt') || !function_exists('mcrypt_decrypt')) {
$msg='Cryptography extension mcrypt is not enabled or installed. IMAP/POP passwords are being stored as plain text in database.';
Sys::log(LOG_WARN,'mcrypt missing',$msg);
return $text;
}
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,$salt, $text, MCRYPT_MODE_ECB,
mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}
function decrypt($text, $salt) {
if(!function_exists('mcrypt_encrypt') || !function_exists('mcrypt_decrypt'))
return $text;
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB,
mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
}
/* misc date helpers...this will go away once we move to php 5 */
function db2gmtime($var){
global $cfg;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment