Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any "out of band" hashes in MD* or SHA-*?

Do any of the common hash algorithms define an "out of band" hash code, i.e. one that is guaranteed to never be the result of the algorithm?

like image 890
Mark Harrison Avatar asked Nov 09 '22 23:11

Mark Harrison


1 Answers

Neither the MD* or SHA-* family of algorithms has an out of band hash value.

If you wish to implement this yourself, you can use the following logic:

  • select a random hash value to be the out of band value.
  • compute the hash.
  • if the hash value (improbably) turns out to be the out of band hash value, assign another hash value.

In pseudocode:

OutOfBandHash = 0xdeadbeefdeadbeefdeadbeefdeadbeef
h = hash(stuff)
if h = OutOfBandHash
    h = OutOfBandHash + 1
like image 86
Mark Harrison Avatar answered Nov 17 '22 18:11

Mark Harrison