Difference between revisions of "HMAC-SHA1"
From Free Pascal wiki
Jump to navigationJump to searchm (→See also: Fix broken mailing list link) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
== Overview == | == Overview == | ||
− | HMAC-SHA1 is a | + | HMAC-SHA1 is an HMAC (hash-based message authentication code), a type of message authentication code using a cryptographic hash function and a secret cryptographic key, generated by the SHA-1 hash algorithm. |
It is implemented in FPC trunk revision 27319 of March 2014. | It is implemented in FPC trunk revision 27319 of March 2014. | ||
Line 8: | Line 8: | ||
Example code: packages/hash/examples/hsha1.pp | Example code: packages/hash/examples/hsha1.pp | ||
− | == See also | + | <syntaxhighlight lang="pascal"> |
− | * Mailing list thread started by the author of the code | + | // 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. | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == See also == | ||
+ | |||
+ | * [https://fpc-pascal.freepascal.narkive.com/eyV27Nra/hmac-sha1-and-fpc#post2 Mailing list thread] started by the author of the code. | ||
+ | |||
* [[HMAC-MD5]] | * [[HMAC-MD5]] | ||
+ | |||
* [[hash]] | * [[hash]] |
Latest revision as of 03:03, 28 October 2021
│
English (en) │
français (fr) │
Overview
HMAC-SHA1 is an HMAC (hash-based message authentication code), a type of message authentication code using a cryptographic hash function and a secret cryptographic key, generated by the SHA-1 hash algorithm.
It is implemented in FPC trunk revision 27319 of March 2014.
Example code: packages/hash/examples/hsha1.pp
// 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.
See also
- Mailing list thread started by the author of the code.