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.

52 lines
1.2 KiB

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