Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cCipherRC4 Class Reference

#include <cCipherRC4.h>

Inheritance diagram for GrayLib::cCipherRC4:
GrayLib::cCipherBase Gray::CObject ICipherBase

Public Member Functions

 cCipherRC4 (bool bEncodeMode=true)
 
 cCipherRC4 (bool bEncodeMode, const void *pKeyData, size_t nKeySize)
 
virtual ~cCipherRC4 (void)
 
virtual HRESULT SetCipherKey (const void *pKeyData=nullptr, size_t nKeySize=0) override
 
virtual HRESULT Cipher (BYTE *pOutput, const BYTE *pInput, size_t nSizeBytes) override
 Bi directional / symmetrical crypt and decrypt. More...
 
 UNITTEST_FRIEND (cCipherRC4)
 
- Public Member Functions inherited from GrayLib::cCipherBase
 cCipherBase (bool bEncodeMode=true, CIPHER_BLOCK_TYPE eBlockMode=CIPHER_BLOCK_UNK) noexcept
 
virtual ~cCipherBase ()
 
void put_EncodeMode (bool bEncodeMode) noexcept
 
bool get_EncodeMode () const noexcept
 
void put_BlockMode (CIPHER_BLOCK_TYPE eBlockMode) noexcept
 
virtual size_t get_BlockAlignSize () const override
 
virtual HRESULT CipherModeECB (BYTE *pOutput, const BYTE *pInput)
 
virtual HRESULT CipherModeCBC (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pIV)
 
virtual HRESULT CipherModeCFB (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pIV, size_t *pIVOffset)
 
virtual HRESULT CipherModeCTR (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pNonceCounter, size_t *pNCOffset, BYTE *pStreamBlock)
 
- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
virtual bool isValidCheck () const noexcept
 < memory allocation and structure definitions are valid. More...
 
virtual void AssertValid () const
 < memory allocation and structure definitions are valid. More...
 
virtual void Serialize (cArchive &a)
 

Protected Attributes

int m_x
 x permutation index More...
 
int m_y
 y permutation index More...
 
BYTE m_Sbox [256]
 state. permutation table More...
 
- Protected Attributes inherited from GrayLib::cCipherBase
bool m_bEncodeMode
 We are in encode/encrypt mode vs decode/decrypt mode. More...
 
CIPHER_BLOCK_TYPE m_eBlockMode
 Cipher block mode. How are sequences of blocks treated? More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GrayLib::cCipherBase
static size_t GRAYCALL CopyFillX (void *pOutput, size_t nOutSize, const void *pInput, size_t nInputSize)
 

Detailed Description

Compatible with RSA RC4 AKA ARC4 used in Secure Sockets Layer (SSL) and WEP. Declared NOT safe in 2015. Not as good as Blowfish but has no BlockAlignSize. http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0

Constructor & Destructor Documentation

◆ cCipherRC4() [1/2]

GrayLib::cCipherRC4::cCipherRC4 ( bool  bEncodeMode = true)

◆ cCipherRC4() [2/2]

GrayLib::cCipherRC4::cCipherRC4 ( bool  bEncodeMode,
const void *  pKeyData,
size_t  nKeySize 
)

◆ ~cCipherRC4()

GrayLib::cCipherRC4::~cCipherRC4 ( void  )
virtual

Member Function Documentation

◆ Cipher()

HRESULT GrayLib::cCipherRC4::Cipher ( BYTE *  pOutput,
const BYTE *  pInput,
size_t  nSizeBytes 
)
overridevirtual

Bi directional / symmetrical crypt and decrypt.

Symmetrical crypt and decrypt.

  • pOutput = buffer for the output data
  • pInput = buffer holding the input data
  • nSize = length of the input data
    Returns
    Amount of data i could process. <0 = error.

Reimplemented from GrayLib::cCipherBase.

◆ SetCipherKey()

HRESULT GrayLib::cCipherRC4::SetCipherKey ( const void *  pKeyData = nullptr,
size_t  nKeySize = 0 
)
overridevirtual

create a fairly simple key based SBox. key schedule.

  • pKeyData = set cipher key. Fix it if unaligned.
  • nKeySize = length of the key, in bytes

Reimplemented from GrayLib::cCipherBase.

◆ UNITTEST_FRIEND()

GrayLib::cCipherRC4::UNITTEST_FRIEND ( cCipherRC4  )

Member Data Documentation

◆ m_Sbox

BYTE GrayLib::cCipherRC4::m_Sbox[256]
protected

state. permutation table

◆ m_x

int GrayLib::cCipherRC4::m_x
protected

x permutation index

◆ m_y

int GrayLib::cCipherRC4::m_y
protected

y permutation index


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