Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cHashWrap.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cHashWrap_H
6 #define _INC_cHashWrap_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "cHashBase.h"
12 #include "cHashTypeDef.h"
14 
15 namespace GrayLib
16 {
18  {
21 
22  public:
23  static const size_t k_HashSizeMax = 64;
24 
27 
28  public:
29  cHashWrap() noexcept
30  : m_pHashTypeDef(nullptr)
31  {
32  }
33  cHashWrap(const cHashTypeDef* pHashTypeDef)
34  : m_pHashTypeDef(nullptr)
35  {
36  SetHashType(pHashTypeDef);
37  }
39  {
40  SetZeroHash();
41  }
42  void SetZeroHash()
43  {
44  m_pHashBase.ReleasePtr(); // assume virtual destructor.
45  m_pHashTypeDef = nullptr;
46  }
47 
48  HRESULT SetHashType(const cHashTypeDef* pHashTypeDef);
49 
50  HRESULT ResetHash();
51  HRESULT ProcessHashBuffer(const BYTE* pBuffer); // TODO GET RID OF THIS.
52  HRESULT AddToHash(const BYTE* pInput, size_t nInputSize);
53  HRESULT FinalizeHash(BYTE* pOutput);
54 
56  HRESULT InitHmac(const BYTE* pKey, size_t nKeySize);
57  HRESULT FinalizeHmac(BYTE* pOutput);
58  HRESULT ResetHmac();
59 
60  void ApplyMask(BYTE* dst, size_t nSizeDst, BYTE* src, size_t nSizeSrc);
61  };
62 }
63 
64 #endif
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cHashTypeDef.h:21
Definition: cHashWrap.h:18
const cHashTypeDef * m_pHashTypeDef
SSL_Hash_TYPE.
Definition: cHashWrap.h:25
cHashWrap() noexcept
Definition: cHashWrap.h:29
void SetZeroHash()
Definition: cHashWrap.h:42
~cHashWrap()
Definition: cHashWrap.h:38
cHashWrap(const cHashTypeDef *pHashTypeDef)
Definition: cHashWrap.h:33
cNewPtr< cHashBase > m_pHashBase
Digest-specific info.
Definition: cHashWrap.h:26
Definition: cNewPtr.h:18
void ReleasePtr() noexcept
Definition: cNewPtr.h:64
Definition: cMesh.h:22
Definition: cDebugAssert.h:29