/** * Symmetric encryption * * @access public static * @param string $text the text to encrypt * @param string $key the private key (default Project Private key) * @return string $decrypted the text decrypted * @see SLS_Security::crypte * @since 1.0 * @example * $uncrypted = SLS_Security::getInstance()->decrypt("VyUA[..]UgCCA="); * var_dump($uncrypted); * // will produce : "sillysmart" */ public static function decrypt($text,$key="") { if ($key == "") $key = SLS_Generic::getInstance()->getSiteConfig('privateKey'); $text = SLS_Security::generateKey(base64_decode($text),$key); $decrypted = ""; for ($i=0;$i<strlen($text);$i++) { $md5 = substr($text,$i,1); $i++; $decrypted.= (substr($text,$i,1) ^ $md5); } return $decrypted; }