What PBKDF2 derives when the password, salt, and iterations are fixed
PBKDF2 stretches a password into key material with a salt and an iteration count. The password is the UTF-8 bytes of the text that was typed. The salt can be read the same way as UTF-8 text, or decoded from hex into bytes before the derivation runs. The PRF is HMAC built from SHA-1, SHA-256, or SHA-512. The output length is chosen in bits from 8 through 8192. At 256 bits with SHA-256 as the PRF, the derived bytes are 32 bytes long.
The password password, the salt salt as four UTF-8 bytes, one iteration, SHA-256 as the PRF, and 256 output bits produce the hex string 120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b. That is 64 hex characters, lowercase, with no spaces. RFC 6070 lists the same password and the salt salt with one iteration under SHA-1 at 160 bits: 0c60c80f961f0e71f4a944a4264269b0799badc3, which is 40 hex characters. Changing the PRF or the output bit count moves the whole string.
Hex spells two digits per byte. Base64 groups bits differently and may add padding. A slow password store may prefer bcrypt or Argon2. A one-shot digest without salt is hash digest. A keyed tag without stretching is HMAC. Wrapping data with a derived AES key is the subject of AES cipher. Salt bytes in hex form are the topic of hex encode and decode.
How the password bytes, salt encoding, PRF, iterations, and output bits decide the derivation
Why SHA-1, SHA-256, and SHA-512 as the PRF change digest width and iteration cost
- The PRF is HMAC with the password as the key. SHA-1 inside HMAC is 160 bits per block step, SHA-256 is 256 bits, and SHA-512 is 512 bits.
- RFC 6070 SHA-1 with password, salt salt, and one iteration at 160 bits is 0c60c80f961f0e71f4a944a4264269b0799badc3. SHA-256 on the same inputs at 256 bits starts with 120fb6cf.
- Each iteration feeds the previous output back into HMAC. A higher iteration count multiplies that work. The PRF name must match on both sides of a check.
Why salt as UTF-8 text is not the same bytes as salt typed as hex digits
- The four letters salt as UTF-8 are the bytes 73 61 6c 74. The eight characters 73616c74 read as hex decode to those same four bytes.
- If hex decoding is off, the tool hashes the eight digit characters as UTF-8 instead, which is eight bytes and a different derivation.
- A newline in the salt field is the byte 0A. salt plus a newline is five bytes, not four, and the derived key moves with it.
Why iteration count one still has a published answer and why higher counts slow checks
- One iteration is valid for test vectors even though password storage normally uses thousands or millions of rounds.
- Password password, salt salt, one iteration, SHA-256, 256 bits always reaches 120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b.
- Doubling iterations roughly doubles the HMAC work for each derive or verify. That cost is the point when the input is a human password.
Why output bits from eight through 8192 set hex length and Base64 length together
- The tool keeps the first dkLen bits of the PRF output stream. Bytes are eight bits each, so 256 bits is 32 bytes.
- Hex uses two characters per byte, so 256 bits is 64 hex characters and 160 bits is 40. Base64 uses four characters per three bytes and may end with equals padding.
- 8192 bits is 1024 bytes, 2048 hex characters, and a longer Base64 line. Eight bits is one byte, one pair of hex digits, and a short Base64 fragment.
Where the published vector and the typed salt quietly disagree
The RFC-style pair password and salt under SHA-256 at one iteration
Password password is eight UTF-8 bytes. Salt salt is four bytes, 73 61 6c 74. With one iteration, SHA-256 as the PRF, and 256 output bits, the hex derived key is 120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b. The same password and salt under SHA-1 at 160 bits and one iteration, as RFC 6070 records, is 0c60c80f961f0e71f4a944a4264269b0799badc3. The password did not change. The PRF and the kept bit count did. Base64 of the 32-byte SHA-256 result is EDL2zPzyizxD5yJSVWxPg3qmVITJLPNUgIBZhXy3C28=.
A salt field that held the hex spelling 73616c74 without hex decoding
The word salt is four bytes. The text 73616c74 is eight characters when read as UTF-8, not four decoded bytes. PBKDF2 with password password, that eight-byte salt, one iteration, and SHA-256 at 256 bits does not start with 120fb6cf. A checklist that expected UTF-8 salt will fail. Turning hex digits into bytes before deriving is what hex encode and decode describes. The derived key is a function of the salt bytes the tool actually fed in, not of the label on the encoding selector.
A login design that stopped at one fast PBKDF2 round
One iteration matches test vectors and proves the implementation, but it is not enough for offline guessing against stolen hashes. Production systems raise the iteration count and still store a unique salt per account. Competitors in the same space include memory-hard Argon2 and bcrypt. A single hash digest of a password skips both salt and iterations. HMAC adds a key but does not stretch guesses the same way. Feeding the derived bytes into AES cipher is a different step from storing the password.