Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

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

Is there a difference between PRF and a hash function?

For example: Creation of a secret key is using PRF and creating a secret key is using hash function.

share|improve this question
You should not be using a PRF to create secret keys. You should be using an RNG or CSPRNG, which may be built out of a PRG. – Stephen Touset May 1 '14 at 20:24
In the first phase of IKE protocol, the pseudo-random function is used to generate the secret keys. – user13342 May 1 '14 at 22:21

No, the two primitives are definitely not the same.

A pseudorandom function is a keyed function that is (computationally) indistinguishable from a function chosen at random from all function with matching domain and range as long as the key remains secret.

On the other hand, a cryptographic hash function is a function with either a publicly known key (in theory) or no key at all (in practice) that is compressing and collision resistant. That means, it maps long inputs to outputs of a fixed length and it is hard to find two inputs that map to the same output.

share|improve this answer
i thought hash functions resemble to a random oracle (in theory), why would they have a public key in theory? – Subhayan May 2 '14 at 23:28
No, hash functions are only modeled as random oracles for proofs in the random oracle model. If we work in the standard model, a hash function is only assumed to be collision resistant. The key of a hash function stems from a technicality of defining collision resistance. The problem is that it is (almost) impossible to define collision resistance for a single function. Therefore collision resistance is defined for a function family, and the key is required to select a member of that family. – Maeher May 3 '14 at 8:20

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.