mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 15:07:02 +03:00
Support PECL xxtea
This commit is contained in:
parent
3948f73fb1
commit
8fe8369b2a
3 changed files with 77 additions and 68 deletions
|
|
@ -1925,7 +1925,7 @@ END;
|
|||
|
||||
public static function HashToId(string $sHash, string $sSalt = '') : int
|
||||
{
|
||||
$sData = $sHash ? @\MailSo\Base\Crypt::XxteaDecrypt(\hex2bin($sHash), \md5($sSalt)) : null;
|
||||
$sData = $sHash ? @\MailSo\Base\Crypt::Decrypt(\hex2bin($sHash), \md5($sSalt)) : null;
|
||||
|
||||
$aMatch = array();
|
||||
if ($sData && preg_match('/^id:(\d+)$/', $sData, $aMatch) && isset($aMatch[1]))
|
||||
|
|
@ -1938,8 +1938,6 @@ END;
|
|||
|
||||
public static function IdToHash(int $iID, string $sSalt = '') : string
|
||||
{
|
||||
return is_int($iID) ?
|
||||
\bin2hex(\MailSo\Base\Crypt::XxteaEncrypt('id:'.$iID, \md5($sSalt))) : null
|
||||
;
|
||||
return \bin2hex(\MailSo\Base\Crypt::Encrypt('id:'.$iID, \md5($sSalt)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue