b2KIT

Key Derivation Calculator

Derive cryptographic keys from passwords using PBKDF2, HKDF, and scrypt with configurable parameters.

Tested tool guide Tested browser tools Checked August 16, 2026

What Key Derivation Calculator does, with a checked example

Key Derivation Calculator turns a password or input keying material into a fixed-length key using PBKDF2, HKDF, or scrypt. Choose the algorithm, supply its salt and algorithm-specific parameters, then compare or copy the derived bytes. The frequent surprise is that the result is not an encrypted password: there is no decrypt operation to recover one, although weak passwords can still be guessed by recomputing candidates. Reproduction requires the same digest, byte encoding, salt, cost settings, optional HKDF info, and output length. The entered material and derived key remain in the browser.

Worked example

A concrete input and expected output from the current implementation.

Input

Algorithm: PBKDF2
PRF: HMAC-SHA-256
Password encoding: UTF-8
Password: password
Salt encoding: UTF-8
Salt: salt
Iterations: 1
Derived length: 32 bytes
Output encoding: hexadecimal

Expected output

120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b

SHA-256 emits 32 bytes, so this request needs one PBKDF2 block. With one iteration, that block is HMAC-SHA-256 keyed by the UTF-8 bytes of "password" over the UTF-8 bytes of "salt" followed by the four-byte block index 00 00 00 01.

How the result is produced

1

Password-based derivation

PBKDF2 treats the password as the pseudorandom-function key and appends a four-byte, big-endian block index to the salt for each output block. It combines the configured number of chained PRF results per block. scrypt takes a password, salt, and N, r, and p cost parameters, then returns the requested number of derived bytes.

2

HKDF extraction and expansion

HKDF separates extraction from expansion. Extraction applies HMAC with the selected digest and salt to input keying material, producing a pseudorandom key. Expansion applies HMAC again with the optional info value and a one-byte block counter until the requested length is filled. HKDF has no password-stretching work factor, so it is not a substitute for PBKDF2 or scrypt on a human password.

Good uses

  • Confirm that a PBKDF2 implementation reproduces a known test vector before integrating password-based encryption.
  • Derive the exact fixture key needed to inspect a test ciphertext when its password, salt, digest, iterations, and key length are documented.
  • Compare HKDF context values or scrypt cost parameters while diagnosing why two systems produce different key bytes.

Limits and checks

  • Plain text, hexadecimal, and Base64 representations are different inputs unless decoded to the same bytes; matching visible characters does not prove byte equality.
  • The output does not measure password strength. An attacker can test guesses with the same public salt and parameters, especially when work settings are low.
  • Copying the correct hex with the wrong requested length, or interpreting a length as bits instead of bytes, creates a different or truncated key.

Common questions

Which derivation method should I choose?

Use PBKDF2 or scrypt when the source is a human password and the receiving format explicitly calls for that KDF. scrypt adds a configurable memory cost; PBKDF2 uses an iteration count. Use HKDF to derive context-specific keys from existing keying material. No, these methods are not interchangeable: existing data or a protocol determines the algorithm and every parameter.

Why does another implementation produce a different key?

Check byte interpretation before changing arithmetic parameters. A salt typed as 73616c74 is eight text characters unless interpreted as hexadecimal; decoded hex is four bytes spelling salt. Then match the digest, output length, password encoding or normalization, and iteration count. For HKDF also match info; for scrypt match N, r, and p. Hexadecimal letter case does not change the bytes.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools