Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was reading up on PBKDF2 and noted the following:

DK = PBKDF2(PRF, Password, Salt, c, dkLen)

PRF is a keyed HMAC, but I can't seem to find out what they use as key for the HMAC?

share|improve this question
If unsure, read the specifications! – Maarten Bodewes Sep 4 '13 at 7:50
up vote 7 down vote accepted

PBKDF2 uses the password as the PRF key.

From the RFC:

The first argument to the pseudorandom function PRF serves as HMAC's "key," and the second serves as HMAC's "text." In the case of PBKDF2, the "key" is thus the password and the "text" is the salt.

share|improve this answer

The password is used as the key, the salt + (current block iteration as a 32-bit integer) is used as the message, then the resultant HMAC is used as the message for the next iteration.

All iterations are XORd with eachother to generate the hash block. If the required output length is less than the size of the hash, it is truncated, if it is larger, the process is repeated with new block iterations until the desired length is reached.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.