Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cCipherRC4.h
Go to the documentation of this file.
1 //
5 //
6 #ifndef _INC_cCipherRC4_H
7 #define _INC_cCipherRC4_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cCipherBase.h"
13 #include "cCipherTypeDef.h"
14 
15 namespace GrayLib
16 {
18  {
24 
25  protected:
26  int m_x;
27  int m_y;
28  BYTE m_Sbox[256];
29 
30  public:
31  cCipherRC4(bool bEncodeMode = true);
32  cCipherRC4(bool bEncodeMode, const void* pKeyData, size_t nKeySize);
33  virtual ~cCipherRC4(void);
34 
35  // cCipherBase support
36  virtual HRESULT SetCipherKey(const void* pKeyData = nullptr, size_t nKeySize = 0) override;
37 
39  virtual HRESULT Cipher(BYTE* pOutput, const BYTE* pInput, size_t nSizeBytes) override;
40 
42  };
43 
45  {
48  public:
50  {
51  }
52  virtual cCipherBase* AllocCipherAlg(bool bEncodeMode) const
53  {
54  return new cCipherRC4(bEncodeMode);
55  }
56  };
57 };
58 
59 #endif // _INC_cCipherRC4_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cCipherTypeDef.h:67
Definition: cCipherRC4.h:45
cCipherAlgRC4()
Definition: cCipherRC4.h:49
virtual cCipherBase * AllocCipherAlg(bool bEncodeMode) const
Definition: cCipherRC4.h:52
Definition: cCipherBase.h:125
Definition: cCipherRC4.h:18
int m_x
x permutation index
Definition: cCipherRC4.h:26
int m_y
y permutation index
Definition: cCipherRC4.h:27
UNITTEST_FRIEND(cCipherRC4)
Definition: cMesh.h:22
@ CipherAlgorithm_RC4
Definition: cCipherBase.h:31