{
    "content": [
        {
            "type": "text",
            "text": "# Crypt::KeyDerivation (perldoc)\n\n## NAME\n\nCrypt::KeyDerivation - PBKDF1, PBKDF2 and HKDF key derivation functions\n\n## SYNOPSIS\n\nuse 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);\n\n## DESCRIPTION\n\nProvides an interface to Key derivation functions:\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **FUNCTIONS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Crypt::KeyDerivation",
        "section": "",
        "mode": "perldoc",
        "summary": "Crypt::KeyDerivation - PBKDF1, PBKDF2 and HKDF key derivation functions",
        "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);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "FUNCTIONS",
                "lines": 70,
                "subsections": []
            }
        ],
        "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": []
            }
        }
    }
}