14

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.

Mike Edward Moras
  • 18,161
  • 12
  • 87
  • 240
user13342
  • 141
  • 1
  • 3

1 Answers1

11

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 functions 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.

Maeher
  • 7,185
  • 1
  • 36
  • 46