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.HashInfo()->crypt_hash()] - string hash(string password, string|void scheme, int|void rounds) + string(0..127) hash(string password, string|void scheme, int|void rounds)   {    function(string, string, int:string(0..255)) crypt_hash;    int salt_size = 16;    int default_rounds = 5000;    -  // FIXME: salt is string(0..255) since constant strings aren't set -  // to the correct type. -  -  string(0..127) render_crypt_hash(string(0..127) scheme, string(0..255) salt, +  string(0..127) render_crypt_hash(string(0..127) scheme, string(0..127) salt,    string(0..255) hash, int rounds)    {    if (rounds != default_rounds) {    salt = "rounds=" + rounds + "$" + salt;    }       // We claim this to be a string(0..127) string, even though we add    // the string(0..256). It will however only be called with the    // already base64 encoded hashes.    return [string(0..127)]sprintf("$%s$%s$%s", scheme, salt, hash);    };    -  string(0..127) render_ldap_hash(string(0..255) scheme, string(0..255) salt, +  string(0..127) render_ldap_hash(string(0..255) scheme, string(0..127) salt,    string(0..255) hash, int rounds)    {    if (scheme[0] != '{') scheme = "{" + scheme + "}";    return [string(0..127)]upper_case(scheme) + MIME.encode_base64(hash + salt);    };    -  function(string(0..127), string(0..255), string(0..255), int:string(0..127)) render_hash = render_crypt_hash; +  function(string(0..127), string(0..127), string(0..255), int:string(0..127)) render_hash = render_crypt_hash;       switch(lower_case(scheme)) {    case "crypt":    case "{crypt}":    case UNDEFINED:    // FALL_THROUGH   #if constant(Nettle.SHA512_Info)    case "6":    case "$6$":    crypt_hash = Crypto.SHA512.crypt_hash;