EnHash

From SQRLauth.net
Revision as of 23:07, 22 March 2015 by Adam Comley (Talk | contribs)

Jump to: navigation, search

EnHash is essentially sixteen (16) chained iterations of SHA-256, with each iteration's output XORed to produce the final result. The EnHash function is described in greater detail at GRC's Key Flow page.

function EnHash (input := 32 byte key) 
{
  tmp    := 32 byte buffer;
  output := 32 byte buffer;

  set output to all NULL (0) bytes;

  for( i = 0; i < 16; i++ ) {
    tmp    = SHA256(input);
    output = output XOR tmp;
    input  = tmp;
  }
  return output;
}

Test Vectors

Enhash-vectors.txt

This is a plain text file containing 1000 tests for the EnHash function. Each line is a test:

  • (43 characters) Base64URL encoded input
  • (43 characters) Base64URL encoded output
  • "\r\n"