本文整理匯總了PHP中Crypto::hash方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypto::hash方法的具體用法?PHP Crypto::hash怎麽用?PHP Crypto::hash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crypto
的用法示例。
在下文中一共展示了Crypto::hash方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getKeyHash
/**
* Function: getKeyHash
*
* Utility function to retrieve the encryption key used by the
* encryption algorithm based on the master key, the sub-key, and some
* known, random seed. The hash returned should be used as the binary key
* for the encryption algorithm.
*
* Parameters:
* seed - (string) third-level seed for the encryption key. This will
* likely an IV or salt value
* len - (int) length of the desired hash
*/
function getKeyHash($seed, $len = 32)
{
$hash = Crypto::hash($this->getMasterKey() . md5($this->getSubKey()), $seed);
return substr($hash, 0, $len);
}