HMAC-SHA1: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: HMAC-SHA1
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Overview | |
| 2 | + | ||
| 3 | + | 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. | |
| 4 | + | ||
| 5 | + | It is implemented in FPC trunk revision 27319 of March 2014. | |
| 6 | + | ||
| 7 | + | Example code: packages/hash/examples/hsha1.pp | |
| 8 | + | ||
| 9 | + | ``` pascal | |
| 10 | + | // See some samples in: http://en.wikipedia.org/wiki/Hash-based_message_authentication_code | |
| 11 | + | program hsha1; | |
| 12 | + | ||
| 13 | + | {$mode objfpc}{$H+} | |
| 14 | + | ||
| 15 | + | uses | |
| 16 | + | HMAC; | |
| 17 | + | ||
| 18 | + | begin | |
| 19 | + | // for HMAC_SHA1("", "") = 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d | |
| 20 | + | WriteLn('Example 1: ', HMACSHA1Print(HMACSHA1Digest('', ''))); | |
| 21 | + | ||
| 22 | + | // for HMAC_SHA1("key", "The quick brown fox jumps over the lazy dog") = 0xde7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 | |
| 23 | + | WriteLn('Example 2: ', HMACSHA1('key', 'The quick brown fox jumps over the lazy dog')); | |
| 24 | + | end. | |
| 25 | + | ``` | |
| 26 | + | ||
| 27 | + | ## See also | |
| 28 | + | ||
| 29 | + | - [Mailing list thread](https://fpc-pascal.freepascal.narkive.com/eyV27Nra/hmac-sha1-and-fpc#post2) started by the author of the code. | |
| 30 | + | ||
| 31 | + | - [[HMAC-MD5]] | |
| 32 | + | ||
| 33 | + | - [[hash]] | |
| 34 | + | ||
| 35 | + | --- | |
| 36 | + | *From the Free Pascal wiki, page "HMAC-SHA1", as it stood on 2021-10-28 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
