Next: HTTP, Previous: FTP, Up: Library modules - Utilities [Contents][Index]
rfc.hmac
- HMAC keyed-hashingThis module implements HMAC algorithm, Keyed-hashing for message authentication, defined in RFC 2104.
For simple batched keyed hashing, you can use high-level API
hmac-digest
and hmac-digest-string
.
Or you can create <hmac>
object and update its state
as the data coming in.
{rfc.hmac}
Keeps state information of HMAC algorithm.
Key and the hashing algorithm should be given at the construction
time, using :key
and :hasher
keyword-arguments respectively.
You can pass any class object that implements message digest
interface (see Message digester framework),
such as <md5>
(see MD5 message digest)
or <sha256>
(see SHA message digest).
Example:
(make <hmac> :key (make-byte-string 16 #x0b) :hasher <md5>)
{rfc.hmac} Updates the internal state of hmac by data, which must be represented by a (possibly incomplete) string.
{rfc.hmac}
Finalizes the internal state of hmac and returns the
hashed string in incomplete string.
You can use digest-hexify
(see Message digester framework) to obtain "hexified"
result.
Once finalized, you can’t call hmac-update!
or hmac-final!
on hmac.
{rfc.hmac}
Creates an <hmac>
object and hash the data stream
from the current input port, then returns the hashed result
in an incomplete string.
{rfc.hmac}
Creates an <hmac>
object and hash the data in string,
then returns the hashed result in an incomplete string.
Next: HTTP, Previous: FTP, Up: Library modules - Utilities [Contents][Index]