ESPHome  2024.11.1
Public Member Functions | Protected Attributes
esphome::md5::MD5Digest Class Reference

#include <md5.h>

Public Member Functions

 MD5Digest ()=default
 
 ~MD5Digest ()=default
 
void init ()
 Initialize a new MD5 digest computation. More...
 
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 MD5 digest as bytes. More...
 
void get_hex (char *output)
 Retrieve the 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_CTX_TYPE ctx_ {}
 
uint8_t digest_ [16]
 

Detailed Description

Definition at line 34 of file md5.h.

Constructor & Destructor Documentation

◆ MD5Digest()

esphome::md5::MD5Digest::MD5Digest ( )
default

◆ ~MD5Digest()

esphome::md5::MD5Digest::~MD5Digest ( )
default

Member Function Documentation

◆ add() [1/2]

void esphome::md5::MD5Digest::add ( const uint8_t *  data,
size_t  len 
)

Add bytes of data for the digest.

Definition at line 16 of file md5.cpp.

◆ add() [2/2]

void esphome::md5::MD5Digest::add ( const char *  data,
size_t  len 
)
inline

Definition at line 44 of file md5.h.

◆ calculate()

void esphome::md5::MD5Digest::calculate ( )

Compute the digest, based on the provided data.

Definition at line 18 of file md5.cpp.

◆ equals_bytes()

bool esphome::md5::MD5Digest::equals_bytes ( const uint8_t *  expected)

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

Definition at line 51 of file md5.cpp.

◆ equals_hex()

bool esphome::md5::MD5Digest::equals_hex ( const char *  expected)

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

Definition at line 60 of file md5.cpp.

◆ get_bytes()

void esphome::md5::MD5Digest::get_bytes ( uint8_t *  output)

Retrieve the MD5 digest as bytes.

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

Definition at line 43 of file md5.cpp.

◆ get_hex()

void esphome::md5::MD5Digest::get_hex ( char *  output)

Retrieve the MD5 digest as hex characters.

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

Definition at line 45 of file md5.cpp.

◆ init()

void esphome::md5::MD5Digest::init ( )

Initialize a new MD5 digest computation.

Definition at line 11 of file md5.cpp.

Field Documentation

◆ ctx_

MD5_CTX_TYPE esphome::md5::MD5Digest::ctx_ {}
protected

Definition at line 64 of file md5.h.

◆ digest_

uint8_t esphome::md5::MD5Digest::digest_[16]
protected

Definition at line 65 of file md5.h.


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