本文整理汇总了PHP中_hash_gensalt_private函数的典型用法代码示例。如果您正苦于以下问题:PHP _hash_gensalt_private函数的具体用法?PHP _hash_gensalt_private怎么用?PHP _hash_gensalt_private使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_hash_gensalt_private函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encryptPassword
/**
* Encrypt the password with a specific algorithm
* @return String
*/
private function encryptPassword()
{
$password = $this->password;
$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$random_state = uniqid();
$random = '';
$count = 6;
if ($fh = @fopen('/dev/urandom', 'rb')) {
$random = fread($fh, $count);
fclose($fh);
}
if (strlen($random) < $count) {
$random = '';
for ($i = 0; $i < $count; $i += 16) {
$random_state = md5(uniqid() . $random_state);
$random .= pack('H*', md5($random_state));
}
$random = substr($random, 0, $count);
}
$hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64);
if (strlen($hash) == 34) {
return $hash;
}
return md5($password);
}
示例2: phpbb_hash
function phpbb_hash($password)
{
$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$random_state = unique_id();
$random = '';
$count = 6;
$random = '';
for ($i = 0; $i < $count; $i += 16) {
$random_state = md5(unique_id() . $random_state);
$random .= pack('H*', md5($random_state));
}
$random = substr($random, 0, $count);
$hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64);
return $hash;
}
示例3: phpbb_hash
function phpbb_hash($password)
{
$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$random = '';
$count = 6;
if ($fh = @fopen('/dev/urandom', 'rb')) {
$random = fread($fh, $count);
fclose($fh);
}
$hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64);
if (strlen($hash) == 34) {
return $hash;
}
return md5($password);
}