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_RC5_H
  2. #define CRYPTOPP_RC5_H
  3. /** \file
  4. */
  5. #include "seckey.h"
  6. #include "secblock.h"
  7. NAMESPACE_BEGIN(CryptoPP)
  8. //! _
  9. struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16>
  10. {
  11. static const char *StaticAlgorithmName() {return "RC5";}
  12. typedef word32 RC5_WORD;
  13. };
  14. /// <a href="http://www.weidai.com/scan-mirror/cs.html#RC5">RC5</a>
  15. class RC5 : public RC5_Info, public BlockCipherDocumentation
  16. {
  17. class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC5_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<RC5_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 RC5::Encryption RC5Encryption;
  40. typedef RC5::Decryption RC5Decryption;
  41. NAMESPACE_END
  42. #endif