diff options
author | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2014-03-28 14:09:52 +0000 |
---|---|---|
committer | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2014-03-28 14:09:52 +0000 |
commit | 8478764c9782f302d1dc427e93e5757bfdfad704 (patch) | |
tree | 732bb723ddf84f1f5d77a3c9ae518289bbdb80d2 /packages/hash/examples/hsha1.pp | |
parent | a2705006fbd6aee7c3d3015e6e530ce41ad2c791 (diff) | |
download | fpc-8478764c9782f302d1dc427e93e5757bfdfad704.tar.gz |
Add implementation of HMAC-MD5 and HMAC-SHA1 from Silvio Clecio. Resolves Mantis #24136
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@27319 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/hash/examples/hsha1.pp')
-rw-r--r-- | packages/hash/examples/hsha1.pp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/hash/examples/hsha1.pp b/packages/hash/examples/hsha1.pp new file mode 100644 index 0000000000..5a79c53c1e --- /dev/null +++ b/packages/hash/examples/hsha1.pp @@ -0,0 +1,15 @@ +// See some samples in: http://en.wikipedia.org/wiki/Hash-based_message_authentication_code +program hsha1; + +{$mode objfpc}{$H+} + +uses + HMAC; + +begin + // for HMAC_SHA1("", "") = 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d + WriteLn('Example 1: ', HMACSHA1Print(HMACSHA1Digest('', ''))); + // for HMAC_SHA1("key", "The quick brown fox jumps over the lazy dog") = 0xde7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 + WriteLn('Example 2: ', HMACSHA1('key', 'The quick brown fox jumps over the lazy dog')); +end. + |