本文整理匯總了PHP中Crypto::Hash方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypto::Hash方法的具體用法?PHP Crypto::Hash怎麽用?PHP Crypto::Hash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crypto
的用法示例。
在下文中一共展示了Crypto::Hash方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DecryptLic
/**
* Decrypt $this->WeakestLic
* @access public
* @return array Decrypted lic
*/
private final function DecryptLic()
{
// Extract sault from license
if ($this->AlgoVersion < 2)
{
$chunks = explode("rmYG", current($this->WeakestLic));
$sault = $chunks[0];
$lic = $chunks[1];
}
else
{
$sault = substr(current($this->WeakestLic), 0, 24);
$lic = substr(current($this->WeakestLic), 24);
}
// Prepare and generate key - the base of trust
$Crypto = new Crypto($this->LicKey);
if ($this->AlgoVersion == 2)
$shash = $Crypto->Hash("{$sault}{$this->LicKey}", "SHA256");
else
$shash = $Crypto->Hash("{$sault} invalid {$this->LicKey}", "SHA256");
$key = substr($shash, 0, 12).substr($shash, -12);
// end
// Decrypt
$retval = $Crypto->Decrypt($lic, $key);
$retval = explode("|", $retval);
$retval = array_map('trim', $retval);
$Crypto = null;
return($retval);
}