本文整理匯總了PHP中BagOStuff::makeKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP BagOStuff::makeKey方法的具體用法?PHP BagOStuff::makeKey怎麽用?PHP BagOStuff::makeKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BagOStuff
的用法示例。
在下文中一共展示了BagOStuff::makeKey方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @param string $secretKeyMaterial
* @param string $algorithm Name of hashing algorithm
* @param BagOStuff $cache
* @param string|array $context Context to mix into HKDF context
* @param CryptRand $cryptRand
* @throws InvalidArgumentException if secret key material is too short
*/
public function __construct($secretKeyMaterial, $algorithm, BagOStuff $cache, $context, CryptRand $cryptRand)
{
if (strlen($secretKeyMaterial) < 16) {
throw new InvalidArgumentException("secret was too short.");
}
$this->skm = $secretKeyMaterial;
$this->algorithm = $algorithm;
$this->cache = $cache;
$this->context = is_array($context) ? $context : [$context];
$this->cryptRand = $cryptRand;
// To prevent every call from hitting the same memcache server, pick
// from a set of keys to use. mt_rand is only use to pick a random
// server, and does not affect the security of the process.
$this->cacheKey = $cache->makeKey('HKDF', mt_rand(0, 16));
}