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.

61 lines
1.5 KiB

  1. #ifndef CRYPTOPP_SKIPJACK_H
  2. #define CRYPTOPP_SKIPJACK_H
  3. /** \file
  4. */
  5. #include "seckey.h"
  6. #include "secblock.h"
  7. NAMESPACE_BEGIN(CryptoPP)
  8. //! _
  9. struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
  10. {
  11. CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";}
  12. };
  13. /// <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a>
  14. class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
  15. {
  16. class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info>
  17. {
  18. public:
  19. void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
  20. unsigned int OptimalDataAlignment() const {return GetAlignmentOf<word16>();}
  21. protected:
  22. static const byte fTable[256];
  23. FixedSizeSecBlock<byte, 10*256> tab;
  24. };
  25. class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
  26. {
  27. public:
  28. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  29. private:
  30. static const byte Se[256];
  31. static const word32 Te[4][256];
  32. };
  33. class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
  34. {
  35. public:
  36. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  37. private:
  38. static const byte Sd[256];
  39. static const word32 Td[4][256];
  40. };
  41. public:
  42. typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
  43. typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
  44. };
  45. typedef SKIPJACK::Encryption SKIPJACKEncryption;
  46. typedef SKIPJACK::Decryption SKIPJACKDecryption;
  47. NAMESPACE_END
  48. #endif