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.2 KiB

  1. #ifndef CRYPTOPP_SHACAL2_H
  2. #define CRYPTOPP_SHACAL2_H
  3. /** \file
  4. */
  5. #include "seckey.h"
  6. #include "secblock.h"
  7. NAMESPACE_BEGIN(CryptoPP)
  8. //! _
  9. struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64>
  10. {
  11. static const char *StaticAlgorithmName() {return "SHACAL-2";}
  12. };
  13. /// <a href="http://www.weidai.com/scan-mirror/cs.html#SHACAL-2">SHACAL-2</a>
  14. class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation
  15. {
  16. class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHACAL2_Info>
  17. {
  18. public:
  19. void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
  20. protected:
  21. FixedSizeSecBlock<word32, 64> m_key;
  22. static const word32 K[64];
  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 SHACAL2::Encryption SHACAL2Encryption;
  39. typedef SHACAL2::Decryption SHACAL2Decryption;
  40. NAMESPACE_END
  41. #endif