From 8478764c9782f302d1dc427e93e5757bfdfad704 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 28 Mar 2014 14:09:52 +0000 Subject: 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 --- packages/hash/examples/hsha1.pp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 packages/hash/examples/hsha1.pp (limited to 'packages/hash/examples/hsha1.pp') 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. + -- cgit v1.2.1