diff --git a/Chaos/Cipher/Block/Cipher.hpp b/Chaos/Cipher/Block/Cipher.hpp new file mode 100644 index 0000000..ec32927 --- /dev/null +++ b/Chaos/Cipher/Block/Cipher.hpp @@ -0,0 +1,35 @@ +#ifndef CHAOS_CIPHER_BLOCK_CIPHER_HPP +#define CHAOS_CIPHER_BLOCK_CIPHER_HPP + +#include +#include + +#include "Key.hpp" +#include "Encryptor.hpp" +#include "Decryptor.hpp" + +namespace Chaos::Cipher::Block +{ + +template +concept Cipher = requires +{ + typename T::Block; + typename T::Key; + typename T::Encryptor; + typename T::Decryptor; + + requires std::unsigned_integral>; + typename std::integral_constant; + + requires std::unsigned_integral>; + typename std::integral_constant; + + requires Key; + requires Encryptor; + requires Decryptor; +}; + +} // namespace Chaos::Cipher::Block + +#endif // CHAOS_CIPHER_BLOCK_CIPHER_HPP diff --git a/Chaos/Cipher/Block/Des/DesCrypt.hpp b/Chaos/Cipher/Block/Des/DesCrypt.hpp index 1e50e76..3e46d6c 100644 --- a/Chaos/Cipher/Block/Des/DesCrypt.hpp +++ b/Chaos/Cipher/Block/Des/DesCrypt.hpp @@ -13,6 +13,7 @@ #include "Cipher/Block/Key.hpp" #include "Cipher/Block/Encryptor.hpp" #include "Cipher/Block/Decryptor.hpp" +#include "Cipher/Block/Cipher.hpp" namespace Chaos::Cipher::Block::Des::Inner_ { @@ -524,6 +525,8 @@ private: } }; +static_assert(Cipher::Block::Cipher); + } // namespace Chaos::Cipher::Block::Des #endif // CHAOS_CIPHER_BLOCK_DES_DESCRYPT_HPP