Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cCipherRotary.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cCipherRotary_H
7 #define _INC_cCipherRotary_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cCipherBase.h"
14 
15 namespace GrayLib
16 {
18  {
22  private:
23  UINT32 m_dwVersion;
24  cUnion64 m_Master;
25  cUnion64 m_Current;
26 
27  private:
30  void Rotary1(BYTE* pOutput, const BYTE* pInput, size_t nLen);
31  void Rotary2(BYTE* pOutput, const BYTE* pInput, size_t nLen);
32  void Rotary3(BYTE* pOutput, const BYTE* pInput, size_t nLen);
33 
34  protected:
35  bool isMasterKeySet() const
36  {
37  return(m_Master.u_dw[0] && m_Master.u_dw[1]);
38  }
39 
40  bool InitCryptMasterKey(UINT32 dwVersion, UINT32 dwKeyHi, UINT32 dwKeyLo);
41  HRESULT put_CipherKey(UINT32 uSeed);
42 
43  public:
44  cCipherRotary(bool bEncodeMode = true);
45  virtual ~cCipherRotary();
46 
47  // cCipherBase
48  virtual HRESULT SetCipherKey(const void* pKeyData = nullptr, size_t nKeySize = 0) override;
49  virtual HRESULT Cipher(BYTE* pOutput, const BYTE* pInput, size_t nSizeBytes) override;
50 
52  };
53 };
54 #endif // _INC_CCRYPTROTARY_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cCipherBase.h:125
Definition: cCipherRotary.h:18
UNITTEST_FRIEND(cCipherRotary)
bool isMasterKeySet() const
Definition: cCipherRotary.h:35
Definition: cMesh.h:22
UINT32 u_dw[2]
HighPart=1, LowPart=0 we assume for USE_LITTLE_ENDIAN.
Definition: cTypes.h:117