MySQL 8.0.40
Source Code Documentation
Digest Class Reference

message digest. More...

#include <digest.h>

Public Types

enum class  Type {
  Md5 , Sha1 , Sha224 , Sha256 ,
  Sha384 , Sha512
}
 

Public Member Functions

 Digest (Type type)
 constructor. More...
 
void reinit ()
 initialize or reinitialize the message digest functions. More...
 
void update (const std::string &data)
 update Digest. More...
 
void update (const std::vector< uint8_t > &data)
 update Digest. More...
 
void finalize (std::vector< uint8_t > &out)
 finalize the digest and get digest value. More...
 
void finalize (std::string &out)
 finalize the digest and get digest value. More...
 

Static Public Member Functions

static size_t digest_size (Type type)
 get size of the digest value. More...
 

Private Member Functions

template<typename Container >
void finalize_impl (Container &out)
 

Static Private Member Functions

static const EVP_MD * get_evp_md (Type type) noexcept
 

Private Attributes

Type type_
 
std::unique_ptr< EVP_MD_CTX, decltype(&EVP_MD_CTX_destroy)> ctx_
 

Detailed Description

message digest.

Wrapper around Digest functions of openssl (EVP_MD_...)

  • MD5
  • SHA1
  • SHA224
  • SHA256
  • SHA384
  • SHA512
See also
openssl's EVP_sha512()

Member Enumeration Documentation

◆ Type

enum class Digest::Type
strong
Enumerator
Md5 
Sha1 
Sha224 
Sha256 
Sha384 
Sha512 

Constructor & Destructor Documentation

◆ Digest()

Digest::Digest ( Type  type)
inline

constructor.

initializes the digest function.

Member Function Documentation

◆ digest_size()

static size_t Digest::digest_size ( Type  type)
inlinestatic

get size of the digest value.

Parameters
typetype of message digest
Returns
size of message digest

◆ finalize() [1/2]

void Digest::finalize ( std::string &  out)
inline

finalize the digest and get digest value.

Parameters
outstring to place the digest value in

◆ finalize() [2/2]

void Digest::finalize ( std::vector< uint8_t > &  out)
inline

finalize the digest and get digest value.

Parameters
outvector to place the digest value in

◆ finalize_impl()

template<typename Container >
void Digest::finalize_impl ( Container &  out)
inlineprivate

◆ get_evp_md()

static const EVP_MD * Digest::get_evp_md ( Type  type)
inlinestaticprivatenoexcept

◆ reinit()

void Digest::reinit ( )
inline

initialize or reinitialize the message digest functions.

Allows reused of the Digest function without reallocating memory.

◆ update() [1/2]

void Digest::update ( const std::string &  data)
inline

update Digest.

Parameters
datadata to update digest function with

◆ update() [2/2]

void Digest::update ( const std::vector< uint8_t > &  data)
inline

update Digest.

Parameters
datadata to update digest function with

Member Data Documentation

◆ ctx_

std::unique_ptr<EVP_MD_CTX, decltype( &EVP_MD_CTX_destroy )> Digest::ctx_
private

◆ type_

Type Digest::type_
private

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