ESPHome  2024.11.1
Public Member Functions | Protected Attributes
esphome::hmac_md5::HmacMD5 Class Reference

#include <hmac_md5.h>

Public Member Functions

 HmacMD5 ()=default
 
 ~HmacMD5 ()=default
 
void init (const uint8_t *key, size_t len)
 Initialize a new MD5 digest computation. More...
 
void init (const char *key, size_t len)
 
void init (const std::string &key)
 
void add (const uint8_t *data, size_t len)
 Add bytes of data for the digest. More...
 
void add (const char *data, size_t len)
 
void calculate ()
 Compute the digest, based on the provided data. More...
 
void get_bytes (uint8_t *output)
 Retrieve the HMAC-MD5 digest as bytes. More...
 
void get_hex (char *output)
 Retrieve the HMAC-MD5 digest as hex characters. More...
 
bool equals_bytes (const uint8_t *expected)
 Compare the digest against a provided byte-encoded digest (16 bytes). More...
 
bool equals_hex (const char *expected)
 Compare the digest against a provided hex-encoded digest (32 bytes). More...
 

Protected Attributes

md5::MD5Digest ihash_
 
md5::MD5Digest ohash_
 

Detailed Description

Definition at line 11 of file hmac_md5.h.

Constructor & Destructor Documentation

◆ HmacMD5()

esphome::hmac_md5::HmacMD5::HmacMD5 ( )
default

◆ ~HmacMD5()

esphome::hmac_md5::HmacMD5::~HmacMD5 ( )
default

Member Function Documentation

◆ add() [1/2]

void esphome::hmac_md5::HmacMD5::add ( const uint8_t *  data,
size_t  len 
)

Add bytes of data for the digest.

Definition at line 36 of file hmac_md5.cpp.

◆ add() [2/2]

void esphome::hmac_md5::HmacMD5::add ( const char *  data,
size_t  len 
)
inline

Definition at line 23 of file hmac_md5.h.

◆ calculate()

void esphome::hmac_md5::HmacMD5::calculate ( )

Compute the digest, based on the provided data.

Definition at line 38 of file hmac_md5.cpp.

◆ equals_bytes()

bool esphome::hmac_md5::HmacMD5::equals_bytes ( const uint8_t *  expected)

Compare the digest against a provided byte-encoded digest (16 bytes).

Definition at line 52 of file hmac_md5.cpp.

◆ equals_hex()

bool esphome::hmac_md5::HmacMD5::equals_hex ( const char *  expected)

Compare the digest against a provided hex-encoded digest (32 bytes).

Definition at line 54 of file hmac_md5.cpp.

◆ get_bytes()

void esphome::hmac_md5::HmacMD5::get_bytes ( uint8_t *  output)

Retrieve the HMAC-MD5 digest as bytes.

The output must be able to hold 16 bytes or more.

Definition at line 48 of file hmac_md5.cpp.

◆ get_hex()

void esphome::hmac_md5::HmacMD5::get_hex ( char *  output)

Retrieve the HMAC-MD5 digest as hex characters.

The output must be able to hold 32 bytes or more.

Definition at line 50 of file hmac_md5.cpp.

◆ init() [1/3]

void esphome::hmac_md5::HmacMD5::init ( const uint8_t *  key,
size_t  len 
)

Initialize a new MD5 digest computation.

Definition at line 9 of file hmac_md5.cpp.

◆ init() [2/3]

void esphome::hmac_md5::HmacMD5::init ( const char *  key,
size_t  len 
)
inline

Definition at line 18 of file hmac_md5.h.

◆ init() [3/3]

void esphome::hmac_md5::HmacMD5::init ( const std::string &  key)
inline

Definition at line 19 of file hmac_md5.h.

Field Documentation

◆ ihash_

md5::MD5Digest esphome::hmac_md5::HmacMD5::ihash_
protected

Definition at line 43 of file hmac_md5.h.

◆ ohash_

md5::MD5Digest esphome::hmac_md5::HmacMD5::ohash_
protected

Definition at line 44 of file hmac_md5.h.


The documentation for this class was generated from the following files: