Example #1
0
 public static function decrypt($string, $key = '')
 {
     $decrypted = null;
     $decodedString = base64_decode($string);
     if (function_exists("mcrypt_generic") && mcrypt_module_self_test(MCRYPT_WAKE)) {
         $decrypted = jCrypt::mcryptDecrypt($decodedString, $key);
     } else {
         $decrypted = jCrypt::simpleCrypt($decodedString, $key);
     }
     return $decrypted;
 }
Example #2
0
 /**
  * Decrypt a string with a specific key
  * @param string $string the string to decrypt
  * @param string $key the key used to decrypt
  * @return string decrypted string
  */
 public static function decrypt($string, $key)
 {
     $decrypted = null;
     $decodedString = base64_decode($string);
     // Check if mcrypt is installed, and if WAKE algo exists
     if (function_exists("mcrypt_generic") && mcrypt_module_self_test(MCRYPT_WAKE)) {
         $decrypted = jCrypt::mcryptDecrypt($decodedString, $key);
     } else {
         $decrypted = jCrypt::simpleCrypt($decodedString, $key);
     }
     return $decrypted;
 }