Difference between revisions of "EnHash"

From SQRLauth.net
Jump to: navigation, search
(Simplified pseudocode)
 
Line 4: Line 4:
 
function EnHash (input := 32 byte key)  
 
function EnHash (input := 32 byte key)  
 
{
 
{
  tmp    := 32 byte buffer;
 
 
   output := 32 byte buffer;
 
   output := 32 byte buffer;
  
Line 10: Line 9:
  
 
   for( i = 0; i < 16; i++ ) {
 
   for( i = 0; i < 16; i++ ) {
     tmp    = SHA256(input);
+
     input  = SHA256(input);
     output = output XOR tmp;
+
     output = output XOR input;
    input = tmp;
+
 
   }
 
   }
 
   return output;
 
   return output;

Latest revision as of 21:08, 25 March 2015

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) 
{
  output := 32 byte buffer;

  set output to all NULL (0) bytes;

  for( i = 0; i < 16; i++ ) {
    input  = SHA256(input);
    output = output XOR input;
  }
  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"