AES-DH Implementation
Loading...
Searching...
No Matches
hmac Namespace Reference

This namespace includes the functions needed to generate an HMAC value Using OpenSSL. More...

Functions

std::string generate (const std::string &message, const std::array< uint64_t, 4 > &key, const size_t &rounds)
 Generate an HMAC for a message.
 

Variables

unsigned char md_value [EVP_MAX_MD_SIZE]
 
unsigned int md_len = 0
 

Detailed Description

This namespace includes the functions needed to generate an HMAC value Using OpenSSL.

Remarks
To compile, add -lssl -lcrypto to your compiler's arguments!

Function Documentation

◆ generate()

std::string hmac::generate ( const std::string & message,
const std::array< uint64_t, 4 > & key,
const size_t & rounds )

Generate an HMAC for a message.

Parameters
messageThe string to compute the HMAC for.
keyThe set of prime numbers to use as the key.
roundsThe amount of AES rounds (To determine key size)
Returns
A string containing the HMAC value.
Exceptions
std::runtime_errorif the HMAC could not be generated.
std::runtime_errorif the round amount is invalid.
Remarks
This function uses the OpenSSL implementation of HMAC-SHA256.
https://docs.openssl.org/master/man3/HMAC/#synopsis