ESPHome 2025.10.0-dev
Loading...
Searching...
No Matches
esphome::sha256::SHA256 Class Reference

#include <sha256.h>

Inheritance diagram for esphome::sha256::SHA256:
esphome::HashBase

Public Member Functions

 SHA256 ()=default
 
 ~SHA256 () override
 
void init () override
 
void add (const uint8_t *data, size_t len) override
 
void add (const std::string &data)
 
void calculate () override
 
size_t get_size () const override
 Get the size of the hash in bytes (32 for SHA256)
 
void add (const char *data, size_t len)
 
- Public Member Functions inherited from esphome::HashBase
virtual ~HashBase ()=default
 
void add (const char *data, size_t len)
 
void get_bytes (uint8_t *output)
 Retrieve the hash as bytes.
 
void get_hex (char *output)
 Retrieve the hash as hex characters.
 
bool equals_bytes (const uint8_t *expected)
 Compare the hash against a provided byte-encoded hash.
 
bool equals_hex (const char *expected)
 Compare the hash against a provided hex-encoded hash.
 

Protected Attributes

mbedtls_sha256_context ctx_ {}
 
br_sha256_context ctx_ {}
 
bool calculated_ {false}
 
EVP_MD_CTX * ctx_ {nullptr}
 
- Protected Attributes inherited from esphome::HashBase
uint8_t digest_ [32]
 

Detailed Description

Definition at line 25 of file sha256.h.

Constructor & Destructor Documentation

◆ SHA256()

esphome::sha256::SHA256::SHA256 ( )
default

◆ ~SHA256()

esphome::sha256::SHA256::~SHA256 ( )
overridedefault

Definition at line 13 of file sha256.cpp.

Member Function Documentation

◆ add() [1/3]

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

Definition at line 20 of file hash_base.h.

◆ add() [2/3]

void esphome::sha256::SHA256::add ( const std::string & data)
inline

Definition at line 33 of file sha256.h.

◆ add() [3/3]

void esphome::sha256::SHA256::add ( const uint8_t * data,
size_t len )
overridevirtual

Implements esphome::HashBase.

Definition at line 20 of file sha256.cpp.

◆ calculate()

void esphome::sha256::SHA256::calculate ( )
overridevirtual

Implements esphome::HashBase.

Definition at line 22 of file sha256.cpp.

◆ get_size()

size_t esphome::sha256::SHA256::get_size ( ) const
inlineoverridevirtual

Get the size of the hash in bytes (32 for SHA256)

Implements esphome::HashBase.

Definition at line 38 of file sha256.h.

◆ init()

void esphome::sha256::SHA256::init ( )
overridevirtual

Implements esphome::HashBase.

Definition at line 15 of file sha256.cpp.

Field Documentation

◆ calculated_

bool esphome::sha256::SHA256::calculated_ {false}
protected

Definition at line 45 of file sha256.h.

◆ ctx_ [1/3]

mbedtls_sha256_context esphome::sha256::SHA256::ctx_ {}
protected

Definition at line 42 of file sha256.h.

◆ ctx_ [2/3]

br_sha256_context esphome::sha256::SHA256::ctx_ {}
protected

Definition at line 44 of file sha256.h.

◆ ctx_ [3/3]

EVP_MD_CTX* esphome::sha256::SHA256::ctx_ {nullptr}
protected

Definition at line 47 of file sha256.h.


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