Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

  1. #ifndef CRYPTOPP_RC6_H
  2. #define CRYPTOPP_RC6_H
  3. /** \file
  4. */
  5. #include "seckey.h"
  6. #include "secblock.h"
  7. NAMESPACE_BEGIN(CryptoPP)
  8. //! _
  9. struct RC6_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 255>, public VariableRounds<20>
  10. {
  11. static const char *StaticAlgorithmName() {return "RC6";}
  12. typedef word32 RC6_WORD;
  13. };
  14. /// <a href="http://www.weidai.com/scan-mirror/cs.html#RC6">RC6</a>
  15. class RC6 : public RC6_Info, public BlockCipherDocumentation
  16. {
  17. class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC6_Info>
  18. {
  19. public:
  20. void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
  21. protected:
  22. unsigned int r; // number of rounds
  23. SecBlock<RC6_WORD> sTable; // expanded key table
  24. };
  25. class CRYPTOPP_NO_VTABLE Enc : public Base
  26. {
  27. public:
  28. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  29. };
  30. class CRYPTOPP_NO_VTABLE Dec : public Base
  31. {
  32. public:
  33. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  34. };
  35. public:
  36. typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
  37. typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
  38. };
  39. typedef RC6::Encryption RC6Encryption;
  40. typedef RC6::Decryption RC6Decryption;
  41. NAMESPACE_END
  42. #endif