TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SHA256Hash Class Reference

#include <SHA256.h>

Public Types

typedef std::integral_constant
< uint32, SHA256_DIGEST_LENGTH > 
DigestLength
 

Public Member Functions

 SHA256Hash ()
 
 ~SHA256Hash ()
 
void UpdateBigNumbers (BigNumber *bn0,...)
 
void UpdateData (const uint8 *dta, int len)
 
void UpdateData (const std::string &str)
 
void Initialize ()
 
void Finalize ()
 
uint8GetDigest (void)
 
int GetLength (void) const
 

Private Attributes

SHA256_CTX mC
 
uint8 mDigest [SHA256_DIGEST_LENGTH]
 

Member Typedef Documentation

typedef std::integral_constant<uint32, SHA256_DIGEST_LENGTH> SHA256Hash::DigestLength

Constructor & Destructor Documentation

SHA256Hash::SHA256Hash ( )
24 {
25  SHA256_Init(&mC);
26  memset(mDigest, 0, SHA256_DIGEST_LENGTH * sizeof(uint8));
27 }
SHA256_CTX mC
Definition: SHA256.h:48
uint8 mDigest[SHA256_DIGEST_LENGTH]
Definition: SHA256.h:49
uint8_t uint8
Definition: Define.h:152
SHA256Hash::~SHA256Hash ( )
30 {
31  SHA256_Init(&mC);
32 }
SHA256_CTX mC
Definition: SHA256.h:48

Member Function Documentation

void SHA256Hash::Finalize ( void  )
65 {
66  SHA256_Final(mDigest, &mC);
67 }
SHA256_CTX mC
Definition: SHA256.h:48
uint8 mDigest[SHA256_DIGEST_LENGTH]
Definition: SHA256.h:49

+ Here is the caller graph for this function:

uint8* SHA256Hash::GetDigest ( void  )
inline
44 { return mDigest; }
uint8 mDigest[SHA256_DIGEST_LENGTH]
Definition: SHA256.h:49

+ Here is the caller graph for this function:

int SHA256Hash::GetLength ( void  ) const
inline
45 { return SHA256_DIGEST_LENGTH; }

+ Here is the caller graph for this function:

void SHA256Hash::Initialize ( )
60 {
61  SHA256_Init(&mC);
62 }
SHA256_CTX mC
Definition: SHA256.h:48
void SHA256Hash::UpdateBigNumbers ( BigNumber bn0,
  ... 
)
45 {
46  va_list v;
47  BigNumber* bn;
48 
49  va_start(v, bn0);
50  bn = bn0;
51  while (bn)
52  {
53  UpdateData(bn->AsByteArray().get(), bn->GetNumBytes());
54  bn = va_arg(v, BigNumber*);
55  }
56  va_end(v);
57 }
Definition: BigNumber.h:28
int32 GetNumBytes(void)
Definition: BigNumber.cpp:157
void UpdateData(const uint8 *dta, int len)
Definition: SHA256.cpp:34
std::unique_ptr< uint8[]> AsByteArray(int32 minSize=0, bool littleEndian=true)
Definition: BigNumber.cpp:177

+ Here is the call graph for this function:

void SHA256Hash::UpdateData ( const uint8 dta,
int  len 
)
35 {
36  SHA256_Update(&mC, dta, len);
37 }
SHA256_CTX mC
Definition: SHA256.h:48

+ Here is the caller graph for this function:

void SHA256Hash::UpdateData ( const std::string &  str)
40 {
41  UpdateData((uint8 const*)str.c_str(), str.length());
42 }
void UpdateData(const uint8 *dta, int len)
Definition: SHA256.cpp:34
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

Member Data Documentation

SHA256_CTX SHA256Hash::mC
private
uint8 SHA256Hash::mDigest[SHA256_DIGEST_LENGTH]
private

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