MySQL 8.0.39
Source Code Documentation
sha2_password::SHA256_digest Class Reference

SHA256 digest generator. More...

#include <i_sha2_password_common.h>

Inheritance diagram for sha2_password::SHA256_digest:
[legend]

Public Member Functions

 SHA256_digest ()
 SHA256 digest generator constructor. More...
 
 ~SHA256_digest () override
 Release acquired memory. More...
 
bool update_digest (const void *src, unsigned int length) override
 Update digest with plaintext. More...
 
bool retrieve_digest (unsigned char *digest, unsigned int length) override
 Retrieve generated digest. More...
 
void scrub () override
 Cleanup and reinit. More...
 
bool all_ok ()
 
- Public Member Functions inherited from sha2_password::Generate_digest
virtual ~Generate_digest ()=default
 

Private Member Functions

void init ()
 Initialize digest context. More...
 
void deinit ()
 Release allocated memory for digest context. More...
 

Private Attributes

unsigned char m_digest [CACHING_SHA2_DIGEST_LENGTH]
 Digest output buffer. More...
 
EVP_MD_CTX * md_context
 Digest context. More...
 
bool m_ok
 Status. More...
 

Detailed Description

SHA256 digest generator.

See also
Generate_digest
Digest_info

Constructor & Destructor Documentation

◆ SHA256_digest()

sha2_password::SHA256_digest::SHA256_digest ( )

SHA256 digest generator constructor.

Initializes digest context and sets status of initialization.

If m_ok is set to false at the end, it indicates a problem in initialization.

◆ ~SHA256_digest()

sha2_password::SHA256_digest::~SHA256_digest ( )
override

Release acquired memory.

Member Function Documentation

◆ all_ok()

bool sha2_password::SHA256_digest::all_ok ( )
inline

◆ deinit()

void sha2_password::SHA256_digest::deinit ( )
private

Release allocated memory for digest context.

◆ init()

void sha2_password::SHA256_digest::init ( )
private

Initialize digest context.

  1. Allocate memory for digest context
  2. Call initialization function(s)

◆ retrieve_digest()

bool sha2_password::SHA256_digest::retrieve_digest ( unsigned char *  digest,
unsigned int  length 
)
overridevirtual

Retrieve generated digest.

Parameters
[out]digestDigest text
[in]lengthLength of the digest buffer

Assumption : memory for digest has been allocated

Returns
digest retrieval status
Return values
trueError
falseSuccess

Implements sha2_password::Generate_digest.

◆ scrub()

void sha2_password::SHA256_digest::scrub ( )
overridevirtual

Cleanup and reinit.

Implements sha2_password::Generate_digest.

◆ update_digest()

bool sha2_password::SHA256_digest::update_digest ( const void *  src,
unsigned int  length 
)
overridevirtual

Update digest with plaintext.

Parameters
[in]srcPlaintext to be added
[in]lengthLength of the plaintext
Returns
digest update status
Return values
trueProblem updating digest
falseSuccess

Implements sha2_password::Generate_digest.

Member Data Documentation

◆ m_digest

unsigned char sha2_password::SHA256_digest::m_digest[CACHING_SHA2_DIGEST_LENGTH]
private

Digest output buffer.

◆ m_ok

bool sha2_password::SHA256_digest::m_ok
private

Status.

◆ md_context

EVP_MD_CTX* sha2_password::SHA256_digest::md_context
private

Digest context.


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