Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:08

0001 // rc6.h - originally written and placed in the public domain by Wei Dai

0002 
0003 /// \file rc6.h

0004 /// \brief Classes for the RC6 block cipher

0005 /// \since Crypto++ 3.0

0006 
0007 #ifndef CRYPTOPP_RC6_H
0008 #define CRYPTOPP_RC6_H
0009 
0010 #include "seckey.h"
0011 #include "secblock.h"
0012 
0013 NAMESPACE_BEGIN(CryptoPP)
0014 
0015 /// \brief RC6 block cipher information

0016 /// \since Crypto++ 3.0

0017 struct RC6_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, public VariableRounds<20>
0018 {
0019     CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "RC6";}
0020     typedef word32 RC6_WORD;
0021 };
0022 
0023 /// \brief RC6 block cipher

0024 /// \sa <a href="http://www.cryptopp.com/wiki/RC6">RC6</a>

0025 /// \since Crypto++ 3.0

0026 class RC6 : public RC6_Info, public BlockCipherDocumentation
0027 {
0028     class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC6_Info>
0029     {
0030     public:
0031         void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
0032 
0033     protected:
0034         unsigned int r;       // number of rounds

0035         SecBlock<RC6_WORD> sTable;  // expanded key table

0036     };
0037 
0038     class CRYPTOPP_NO_VTABLE Enc : public Base
0039     {
0040     public:
0041         void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0042     };
0043 
0044     class CRYPTOPP_NO_VTABLE Dec : public Base
0045     {
0046     public:
0047         void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0048     };
0049 
0050 public:
0051     typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
0052     typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
0053 };
0054 
0055 typedef RC6::Encryption RC6Encryption;
0056 typedef RC6::Decryption RC6Decryption;
0057 
0058 NAMESPACE_END
0059 
0060 #endif