pike.git / lib / modules / Crypto.pmod / Password.pmod

version» Context lines:

pike.git/lib/modules/Crypto.pmod/Password.pmod:256:   //! @note   //! Note that the availability of @[SHA512] depends on the version   //! of @[Nettle] that Pike has been compiled with.   //!   //! @note   //! This function was added in Pike 7.8.755.   //!   //! @seealso   //! @[verify()], @[predef::crypt()], @[Nettle.crypt_md5()],   //! @[Nettle.Hash()->crypt_hash()] - string(7bit) hash(string(8bit) password, string|void scheme, int|void rounds) + string(7bit) hash(string(8bit) password, string(7bit)|void scheme, +  int|void rounds)   {    function(string(8bit), string(7bit), int:string(8bit)) crypt_hash;    int salt_size = 16;    int default_rounds = 5000;       string(7bit) render_crypt_hash(string(7bit) scheme, string(7bit) salt,    string(8bit) hash, int rounds)    {    if (rounds != default_rounds) {    salt = "rounds=" + rounds + "$" + salt;    }       // We claim this to be a string(7bit) string, even though we add    // the string(0..256). It will however only be called with the    // already base64 encoded hashes. -  return [string(7bit)]sprintf("$%s$%s$%s", scheme, salt, hash); +  return sprintf("$%s$%s$%s", scheme, salt, [string(7bit)]hash);    };       string(7bit) render_ldap_hash(string(8bit) scheme, string(7bit) salt,    string(8bit) hash, int rounds)    {    if (scheme[0] != '{') scheme = "{" + scheme + "}";    return [string(7bit)]upper_case(scheme) + MIME.encode_base64(hash + salt);    };       function(string(7bit), string(7bit), string(8bit), int:string(7bit)) render_hash = render_crypt_hash;