当前位置: 首页>>代码示例>>PHP>>正文


PHP _hash_crypt_private函数代码示例

本文整理汇总了PHP中_hash_crypt_private函数的典型用法代码示例。如果您正苦于以下问题:PHP _hash_crypt_private函数的具体用法?PHP _hash_crypt_private怎么用?PHP _hash_crypt_private使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_hash_crypt_private函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:GlassFace,项目名称:FusionCMS,代码行数:29,代码来源:phpbb.php

示例2: phpbb_check_hash

/**
* Check for correct password
*
* @param string $password The password in plain text
* @param string $hash The stored password hash
*
* @return bool Returns true if the password is correct, false if not.
*/
function phpbb_check_hash($password, $hash)
{
    $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    if (strlen($hash) == 34) {
        return _hash_crypt_private($password, $hash, $itoa64) === $hash ? true : false;
    }
    return md5($password) === $hash ? true : false;
}
开发者ID:daddysboy2001,项目名称:NamelessMC,代码行数:16,代码来源:phpbb_hash.php

示例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);
}
开发者ID:netsocDIT,项目名称:serversetup,代码行数:15,代码来源:phpbbhash.php

示例4: auth

 /**
  * Try and authenticate for our password compatibility scheme.
  *
  * @param  ?SHORT_TEXT	The member username (NULL: don't use this in the authentication - but look it up using the ID if needed)
  * @param  ?MEMBER		The member id (NULL: use member name)
  * @param  MD5				The md5-hashed password
  * @param  string			The raw password
  * @param  boolean		Whether this is a cookie login
  * @param  array			Row of OCF account
  * @return ?tempcode		Error message (NULL: none)
  */
 function auth($username, $userid, $password_hashed, $password_raw, $cookie_login, $row)
 {
     if ($cookie_login) {
         if ($row['m_pass_hash_salted'] != $password_hashed) {
             return do_lang_tempcode('USER_BAD_PASSWORD');
         }
     } else {
         require_code('forum/phpbb3');
         $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
         if (_hash_crypt_private($password_raw, $row['m_pass_hash_salted'], $itoa64) != $row['m_pass_hash_salted']) {
             return do_lang_tempcode('USER_BAD_PASSWORD');
         }
     }
     return NULL;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:26,代码来源:phpbb3.php

示例5: forum_md5

 /**
  * The hashing algorithm of this forum driver. NOT used for cookie logins for this forum driver (cookies store a generated session ID).
  *
  * @param  string			The data to hash (the password in actuality)
  * @param  string			The string converted member-ID in actuality, although this function is more general. For cookie logins, 'ys'
  * @param  boolean		Whether to just get the old style hash
  * @return string			The hashed data
  */
 function forum_md5($data, $key, $just_first = false)
 {
     $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
     $hash = $GLOBALS['FORUM_DB']->query_value_null_ok('users', 'user_password', array('username_clean' => strtolower($key)));
     if (is_null($hash)) {
         return '';
     }
     return _hash_crypt_private($data, $hash, $itoa64);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:17,代码来源:phpbb3.php

示例6: phpbb_check_hash

/**
* Check for correct password
*
* @param string $password The password in plain text
* @param string $hash The stored password hash
*
* @return bool Returns true if the password is correct, false if not.
*/
function phpbb_check_hash($password, $hash)
{
    if (strlen($password) > 4096) {
        // If the password is too huge, we will simply reject it
        // and not let the server try to hash it.
        return false;
    }
    $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    if (strlen($hash) == 34) {
        return _hash_crypt_private($password, $hash, $itoa64) === $hash ? true : false;
    }
    return md5($password) === $hash ? true : false;
}
开发者ID:PetsFundation,项目名称:Pets,代码行数:21,代码来源:functions.php


注:本文中的_hash_crypt_private函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。