|
E-MailRelay
|
A class for creating HMACs using an arbitrary cryptographic hash function. More...
#include <ghash.h>
Classes | |
| struct | Masked |
| An overload discriminator for G::Hash::hmac() More... | |
Public Member Functions | |
| template<typename Fn , typename Fn2 > | |
| std::string | mask (Fn predigest_fn, Fn2 digest_fn, size_t blocksize, const std::string &k) |
Static Public Member Functions | |
| template<typename Fn2 > | |
| static std::string | hmac (Fn2 digest, size_t blocksize, const std::string &key, const std::string &input) |
| Computes a Hashed Message Authentication Code using given hash function. More... | |
| template<typename Fn2 > | |
| static std::string | hmac (Fn2 postdigest, const std::string &masked_key, const std::string &input, Masked) |
| An hmac() overload using a masked key. | |
| template<typename Fn1 , typename Fn2 > | |
| static std::string | mask (Fn1 predigest, Fn2 digest, size_t blocksize, const std::string &shared_key) |
| Computes a masked key from the given shared key, returning a non-printable string. More... | |
| static std::string | printable (const std::string &input) |
| Converts a binary string into a printable form, using a lowercase hexadecimal encoding. More... | |
A class for creating HMACs using an arbitrary cryptographic hash function.
|
inlinestatic |
Computes a Hashed Message Authentication Code using given hash function.
This is typically for challenge-response authentication where the plaintext input is an arbitrary challenge string from the server that the client has to hmac() using their shared private key.
See also RFC-2104 [HMAC-MD5].
For hash function H with block size B (64) using shared key SK:
The H() function processes a stream of blocks; the first parameter above represents the first block, and the second parameter is the rest of the stream (zero-padded up to a block boundary).
The shared key can be up to B bytes, or if more than B bytes then K is the L-byte result of hashing the shared-key. K is zero-padded up to B bytes for XOR-ing.
|
static |
Computes a masked key from the given shared key, returning a non-printable string.
This can be passed to the 'masked' overload of hmac() once the message is known.
A masked key (MK) is the result of doing the initial, plaintext-independent parts of HMAC computation, taking the intermediate state of both the inner and outer hash functions.
|
static |
1.8.9.1