<div dir="ltr"><div style><div>My function is more fast that cHash (<a href="http://fundementals.sourceforge.net/dl.html">http://fundementals.sourceforge.net/dl.html</a>). The comparison result is:</div><div><br></div><div>

HMAC: 00:00:01:689 cHash: 00:00:02:038</div><div><br></div><div>My final unit is:</div><div><br></div><div><a href="http://pastebin.com/4484g9i8">http://pastebin.com/4484g9i8</a></div><div><br></div><div>The code used in comparison:</div>

<div><br></div><div>uses</div><div>  HMAC, cHash;</div><div><br></div><div>procedure TForm1.Button1Click(Sender: TObject);</div><div>var</div><div>  i: Integer;</div><div>  b, e: TDateTime;</div><div>  x: string;</div><div>

begin</div><div>  b := now;</div><div>  for i := 0 to 300000 do</div><div>    x := HMACSHA1('secret', 'The quick brown fox jumped over the lazy dog.');</div><div>  e := now;</div><div>  Edit1.Text := 'HMAC: ' + FormatDateTime('hh:nn:ss:zzz', b - e);</div>

<div>  b := now;</div><div>  for i := 0 to 300000 do</div><div>    x := SHA1DigestToHex(CalcHMAC_SHA1('secret', 'The quick brown fox jumped over the lazy dog.'));</div><div>  e := now;</div><div>  Edit1.Text := Edit1.Text + ' cHash: ' + FormatDateTime('hh:nn:ss:zzz', b - e);</div>

<div>end;</div><div><br></div><div>I reinvented the wheel, but I can run faster now. :)<br></div><div><br></div><div style>Thanks guys!</div><div><br></div><div>--</div><div>Silvio Clécio</div><div>My public projects - <a href="http://github.com/silvioprog">github.com/silvioprog</a></div>

</div></div>