MySQL 8.0.30
Source Code Documentation
sha2_password::Generate_scramble Class Reference

Scramble generator Responsible for generating scramble of following format: XOR(SHA2(m_src), SHA2(SHA2(SHA2(m_src)), m_rnd)) More...

#include <i_sha2_password_common.h>

Public Member Functions

 Generate_scramble (const std::string source, const std::string rnd, Digest_info digest_type=Digest_info::SHA256_DIGEST)
 Generate_scramble constructor. More...
 
 ~Generate_scramble ()
 Generate_scramble destructor. More...
 
bool scramble (unsigned char *scramble, unsigned int scramble_length)
 Scramble generation. More...
 

Private Attributes

std::string m_src
 plaintext source string More...
 
std::string m_rnd
 random string More...
 
Digest_info m_digest_type
 Type of digest. More...
 
Generate_digestm_digest_generator
 Digest generator class. More...
 
unsigned int m_digest_length
 length of the digest More...
 

Detailed Description

Scramble generator Responsible for generating scramble of following format: XOR(SHA2(m_src), SHA2(SHA2(SHA2(m_src)), m_rnd))

See also
SHA256_digest
Digest_info

Constructor & Destructor Documentation

◆ Generate_scramble()

sha2_password::Generate_scramble::Generate_scramble ( const std::string  source,
const std::string  rnd,
Digest_info  digest_type = Digest_info::SHA256_DIGEST 
)

Generate_scramble constructor.

Parameters
[in]sourcePlaintext source
[in]rndSalt
[in]digest_typeDigest type

◆ ~Generate_scramble()

sha2_password::Generate_scramble::~Generate_scramble ( )

Generate_scramble destructor.

Member Function Documentation

◆ scramble()

bool sha2_password::Generate_scramble::scramble ( unsigned char *  scramble,
unsigned int  scramble_length 
)

Scramble generation.

Parameters
[out]scrambleOutput buffer for generated scramble
[in]scramble_lengthSize of scramble buffer
Note
SHA2(src) => digest_stage1 SHA2(digest_stage1) => digest_stage2 SHA2(digest_stage2, m_rnd) => scramble_stage1 XOR(digest_stage1, scramble_stage1) => scramble
Returns
Status of scramble generation
Return values
trueError generating scramble
falseSuccess

Member Data Documentation

◆ m_digest_generator

Generate_digest* sha2_password::Generate_scramble::m_digest_generator
private

Digest generator class.

◆ m_digest_length

unsigned int sha2_password::Generate_scramble::m_digest_length
private

length of the digest

◆ m_digest_type

Digest_info sha2_password::Generate_scramble::m_digest_type
private

Type of digest.

◆ m_rnd

std::string sha2_password::Generate_scramble::m_rnd
private

random string

◆ m_src

std::string sha2_password::Generate_scramble::m_src
private

plaintext source string


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