Пример #1
0
 /**
  * @param string $sHash
  * @param string $sSalt
  *
  * @return int
  */
 public static function HashToId($sHash, $sSalt = '')
 {
     $sData = $sHash ? @\MailSo\Base\Crypt::XxteaDecrypt(\hex2bin($sHash), \md5($sSalt)) : null;
     $aMatch = array();
     if ($sData && preg_match('/^id:(\\d+)$/', $sData, $aMatch) && isset($aMatch[1])) {
         return is_numeric($aMatch[1]) ? (int) $aMatch[1] : null;
     }
     return null;
 }
 /**
  * @param string $sEncriptedString
  * @param string $sKey
  *
  * @return string
  */
 public static function DecryptString($sEncriptedString, $sKey)
 {
     return \MailSo\Base\Crypt::XxteaDecrypt($sEncriptedString, $sKey);
 }
Пример #3
0
 /**
  * @param string $sEncriptedString
  * @param string $sKey
  *
  * @return string
  */
 public static function DecryptStringQ($sEncriptedString, $sKey)
 {
     //		if (\MailSo\Base\Utils::FunctionExistsAndEnabled('openssl_pkey_get_private'))
     //		{
     //			return \RainLoop\Utils::DecryptStringRSA($sEncriptedString,
     //				$sKey.'Q'.\RainLoop\Utils::GetShortToken());
     //		}
     return \MailSo\Base\Crypt::XxteaDecrypt($sEncriptedString, $sKey . 'Q' . \RainLoop\Utils::GetShortToken());
 }