本文整理汇总了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));
}