2

Does there exist any hashing function that has a different output for all of the messages?

For example, let's say we have the function $H_{256}(x)$

Where $H$ is a 256 bit digest. Is it possible to construct $H$ so that it has a different output for every combination from $0$ to $(2^{256}-1)$?

EDIT: what I mean is, if you have a hash function which produces a fixed length 256 bit digest, is it possible to make such function so that every permutation of 1's and 0's of length 256 have a different output? I hope I'm clear now

1 Answers1

1

What you are looking for is a permutation, and not normally what we call a hash function. The identity function is a permutation and so is modular addition. And many more.

You probably want some other properties of cryptographicly secure hash functions such as preimage resistance.

A pseudo random permutation will suffice any secure block cipher such as AES will meet the bill.

Note this in itself isn't a usefull hash function, for hash functions we want a compression function where the output is smaller than the input. From pigeon hole principal it is obvious that if the output domain of a function is smaller than it's input domain it must have collisions and can not be a permutation.

With cryptographically secure hash functions like SHA-3 we fully expect there to be many collisions even when the input domain is restricted to match the output domain we simply don't know how to find any such collisions which is a basic requirement for cryptographically secure hash functions.

AleksanderCH
  • 6,511
  • 10
  • 31
  • 64
Meir Maor
  • 12,053
  • 1
  • 24
  • 55