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.

53 lines
1.2 KiB

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