seed.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // seed.h - originally written and placed in the public domain by Wei Dai
  2. /// \file seed.h
  3. /// \brief Classes for the SEED block cipher
  4. /// \since Crypto++ 5.6.0
  5. #ifndef CRYPTOPP_SEED_H
  6. #define CRYPTOPP_SEED_H
  7. #include "seckey.h"
  8. #include "secblock.h"
  9. NAMESPACE_BEGIN(CryptoPP)
  10. /// \brief SEED block cipher information
  11. /// \since Crypto++ 5.6.0
  12. struct SEED_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, public FixedRounds<16>
  13. {
  14. CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SEED";}
  15. };
  16. /// \brief SEED block cipher
  17. /// \sa <a href="http://www.cryptolounge.org/wiki/SEED">SEED</a>
  18. /// \since Crypto++ 5.6.0
  19. class SEED : public SEED_Info, public BlockCipherDocumentation
  20. {
  21. class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SEED_Info>
  22. {
  23. public:
  24. void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
  25. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  26. protected:
  27. FixedSizeSecBlock<word32, 32> m_k;
  28. };
  29. public:
  30. typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
  31. typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
  32. };
  33. NAMESPACE_END
  34. #endif