I changed it to:

http://pastebin.com/mxeWtncP

And now:

cHash: 00:00:02:188 HMAC: 00:00:00:966

2013/3/24 silvioprog <silviop...@gmail.com>

> My function is more fast that cHash (
> http://fundementals.sourceforge.net/dl.html). The comparison result is:
>
>  HMAC: 00:00:01:689 cHash: 00:00:02:038
>
> My final unit is:
>
> http://pastebin.com/4484g9i8
>
> The code used in comparison:
>
> uses
>   HMAC, cHash;
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
>   i: Integer;
>   b, e: TDateTime;
>   x: string;
> begin
>   b := now;
>   for i := 0 to 300000 do
>     x := HMACSHA1('secret', 'The quick brown fox jumped over the lazy
> dog.');
>   e := now;
>   Edit1.Text := 'HMAC: ' + FormatDateTime('hh:nn:ss:zzz', b - e);
>   b := now;
>   for i := 0 to 300000 do
>     x := SHA1DigestToHex(CalcHMAC_SHA1('secret', 'The quick brown fox
> jumped over the lazy dog.'));
>   e := now;
>   Edit1.Text := Edit1.Text + ' cHash: ' + FormatDateTime('hh:nn:ss:zzz', b
> - e);
> end;
>
> I reinvented the wheel, but I can run faster now. :)
>
> Thanks guys!
>

-- 
Silvio Clécio
My public projects - github.com/silvioprog
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to