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

#include <SHA1.h>

Public Types

typedef std::integral_constant
< uint32, SHA_DIGEST_LENGTH > 
DigestLength
 

Public Member Functions

 SHA1Hash ()
 
 ~SHA1Hash ()
 
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

SHA_CTX mC
 
uint8 mDigest [SHA_DIGEST_LENGTH]
 

Member Typedef Documentation

typedef std::integral_constant<uint32, SHA_DIGEST_LENGTH> SHA1Hash::DigestLength

Constructor & Destructor Documentation

SHA1Hash::SHA1Hash ( )
25 {
26  SHA1_Init(&mC);
27  memset(mDigest, 0, SHA_DIGEST_LENGTH * sizeof(uint8));
28 }
uint8 mDigest[SHA_DIGEST_LENGTH]
Definition: SHA1.h:50
SHA_CTX mC
Definition: SHA1.h:49
uint8_t uint8
Definition: Define.h:152
SHA1Hash::~SHA1Hash ( )
31 {
32  SHA1_Init(&mC);
33 }
SHA_CTX mC
Definition: SHA1.h:49

Member Function Documentation

void SHA1Hash::Finalize ( void  )
66 {
67  SHA1_Final(mDigest, &mC);
68 }
uint8 mDigest[SHA_DIGEST_LENGTH]
Definition: SHA1.h:50
SHA_CTX mC
Definition: SHA1.h:49

+ Here is the caller graph for this function:

uint8* SHA1Hash::GetDigest ( void  )
inline
45 { return mDigest; }
uint8 mDigest[SHA_DIGEST_LENGTH]
Definition: SHA1.h:50

+ Here is the caller graph for this function:

int SHA1Hash::GetLength ( void  ) const
inline
46 { return SHA_DIGEST_LENGTH; }

+ Here is the caller graph for this function:

void SHA1Hash::Initialize ( )
61 {
62  SHA1_Init(&mC);
63 }
SHA_CTX mC
Definition: SHA1.h:49

+ Here is the caller graph for this function:

void SHA1Hash::UpdateBigNumbers ( BigNumber bn0,
  ... 
)
46 {
47  va_list v;
48  BigNumber* bn;
49 
50  va_start(v, bn0);
51  bn = bn0;
52  while (bn)
53  {
54  UpdateData(bn->AsByteArray().get(), bn->GetNumBytes());
55  bn = va_arg(v, BigNumber*);
56  }
57  va_end(v);
58 }
Definition: BigNumber.h:28
void UpdateData(const uint8 *dta, int len)
Definition: SHA1.cpp:35
int32 GetNumBytes(void)
Definition: BigNumber.cpp:157
std::unique_ptr< uint8[]> AsByteArray(int32 minSize=0, bool littleEndian=true)
Definition: BigNumber.cpp:177

+ Here is the call graph for this function:

void SHA1Hash::UpdateData ( const uint8 dta,
int  len 
)
36 {
37  SHA1_Update(&mC, dta, len);
38 }
SHA_CTX mC
Definition: SHA1.h:49

+ Here is the caller graph for this function:

void SHA1Hash::UpdateData ( const std::string &  str)
41 {
42  UpdateData((uint8 const*)str.c_str(), str.length());
43 }
void UpdateData(const uint8 *dta, int len)
Definition: SHA1.cpp:35
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

Member Data Documentation

SHA_CTX SHA1Hash::mC
private
uint8 SHA1Hash::mDigest[SHA_DIGEST_LENGTH]
private

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