[fpc-pascal] HMAC_SHA1 and FPC
silvioprog
silvioprog at gmail.com
Sun Mar 24 16:59:59 CET 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130324/a94992d2/attachment.html>
More information about the fpc-pascal
mailing list