{
    "mode": "perldoc",
    "parameter": "Crypt::KeyDerivation",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Crypt%3A%3AKeyDerivation/json",
    "generated": "2026-06-09T19:55:48Z",
    "synopsis": "use Crypt::KeyDerivation ':all';\n### PBKDF1/2\n$derivedkey1 = pbkdf1($password, $salt, $iterationcount, $hashname, $len);\n$derivedkey2 = pbkdf2($password, $salt, $iterationcount, $hashname, $len);\n### HKDF & co.\n$derivedkey3 = hkdf($keyingmaterial, $salt, $hashname, $len, $info);\n$prk  = hkdfextract($keyingmaterial, $salt, $hashname);\n$okm1 = hkdfexpand($prk, $hashname, $len, $info);",
    "sections": {
        "NAME": {
            "content": "Crypt::KeyDerivation - PBKDF1, PBKDF2 and HKDF key derivation functions\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Crypt::KeyDerivation ':all';\n\n### PBKDF1/2\n$derivedkey1 = pbkdf1($password, $salt, $iterationcount, $hashname, $len);\n$derivedkey2 = pbkdf2($password, $salt, $iterationcount, $hashname, $len);\n\n### HKDF & co.\n$derivedkey3 = hkdf($keyingmaterial, $salt, $hashname, $len, $info);\n$prk  = hkdfextract($keyingmaterial, $salt, $hashname);\n$okm1 = hkdfexpand($prk, $hashname, $len, $info);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Provides an interface to Key derivation functions:\n\n*   PBKDF1 and PBKDF according to PKCS#5 v2.0 <https://tools.ietf.org/html/rfc2898>\n\n*   HKDF (+ related) according to <https://tools.ietf.org/html/rfc5869>\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "pbkdf1\nBEWARE: if you are not sure, do not use \"pbkdf1\" but rather choose \"pbkdf2\".\n\n$derivedkey = pbkdf1($password, $salt, $iterationcount, $hashname, $len);\n#or\n$derivedkey = pbkdf1($password, $salt, $iterationcount, $hashname);\n#or\n$derivedkey = pbkdf1($password, $salt, $iterationcount);\n#or\n$derivedkey = pbkdf1($password, $salt);\n\n# $password ......... input keying material  (password)\n# $salt ............. salt/nonce (expected length: 8)\n# $iterationcount .. optional, DEFAULT: 5000\n# $hashname ........ optional, DEFAULT: 'SHA256'\n# $len .............. optional, derived key len, DEFAULT: 32\n\npbkdf2\n$derivedkey = pbkdf2($password, $salt, $iterationcount, $hashname, $len);\n#or\n$derivedkey = pbkdf2($password, $salt, $iterationcount, $hashname);\n#or\n$derivedkey = pbkdf2($password, $salt, $iterationcount);\n#or\n$derivedkey = pbkdf2($password, $salt);\n\n# $password ......... input keying material (password)\n# $salt ............. salt/nonce\n# $iterationcount .. optional, DEFAULT: 5000\n# $hashname ........ optional, DEFAULT: 'SHA256'\n# $len .............. optional, derived key len, DEFAULT: 32\n\nhkdf\n$okm2 = hkdf($password, $salt, $hashname, $len, $info);\n#or\n$okm2 = hkdf($password, $salt, $hashname, $len);\n#or\n$okm2 = hkdf($password, $salt, $hashname);\n#or\n$okm2 = hkdf($password, $salt);\n\n# $password ... input keying material (password)\n# $salt ....... salt/nonce, if undef defaults to HashLen zero octets\n# $hashname .. optional, DEFAULT: 'SHA256'\n# $len ........ optional, derived key len, DEFAULT: 32\n# $info ....... optional context and application specific information, DEFAULT: ''\n\nhkdfextract\n$prk  = hkdfextract($password, $salt, $hashname);\n#or\n$prk  = hkdfextract($password, $salt, $hashname);\n\n# $password ... input keying material (password)\n# $salt ....... salt/nonce, if undef defaults to HashLen zero octets\n# $hashname .. optional, DEFAULT: 'SHA256'\n\nhkdfexpand\n$okm = hkdfexpand($pseudokey, $hashname, $len, $info);\n#or\n$okm = hkdfexpand($pseudokey, $hashname, $len);\n#or\n$okm = hkdfexpand($pseudokey, $hashname);\n#or\n$okm = hkdfexpand($pseudokey);\n\n# $pseudokey .. input keying material\n# $hashname .. optional, DEFAULT: 'SHA256'\n# $len ........ optional, derived key len, DEFAULT: 32\n# $info ....... optional context and application specific information, DEFAULT: ''\n",
            "subsections": []
        }
    },
    "summary": "Crypt::KeyDerivation - PBKDF1, PBKDF2 and HKDF key derivation functions",
    "flags": [],
    "examples": [],
    "see_also": []
}