On this page
  1. hashlib.pbkdf2_hmac
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

hashlib.pbkdf2_hmac

Prev: hashlib.new | Up: hashlib | Next: hashlib.sha1
Rel: hashlib.blake2b, hashlib.blake2s, hashlib.file_digest, hashlib.md5
Ref: docs.python.org — hashlib.pbkdf2_hmac
Tags: #public #python3 #stdlib #hashlib


Import

import hashlib
from hashlib import pbkdf2_hmac

Signature & Overview

hashlib.pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None)

Password based key derivation function 2 (PKCS #5 v2.0) with HMAC as pseudorandom function.

Usage

import hashlib

derived = hashlib.pbkdf2_hmac("sha256", b"demo-input", b"unique-salt-16b", 100_000, dklen=32)
assert len(derived) == 32

Gotchas

REPL Inspect

from hashlib import pbkdf2_hmac
help(pbkdf2_hmac)

Linked from

Related notes