133 inline
bool Encrypt(
std::span<const
std::
byte> input, Buffer::WriteOnly& output) const noexcept {
134 return DoEncrypt(input, output);
144 template<StormByte::Type::ByteInputRange Range>
147 for (
const auto value: input) {
150 return Encrypt(std::span<const std::byte>(data), output);
160 return DoEncrypt(
const_cast<Buffer::ReadOnly&
>(input), output, ReadMode::Copy);
170 return DoEncrypt(input, output, ReadMode::Move);
180 return DoEncrypt(consumer, mode);
195 return DoDecrypt(input, output);
205 template<StormByte::Type::ByteInputRange Range>
208 for (
const auto value: input) {
211 return Decrypt(std::span<const std::byte>(data), output);
221 return DoDecrypt(
const_cast<Buffer::ReadOnly&
>(input), output, ReadMode::Copy);
231 return DoDecrypt(input, output, ReadMode::Move);
241 return DoDecrypt(consumer, mode);
reference emplace_back(T &&value)
AES-GCM crypter.
Definition aes_gcm.hxx:64
AES-CBC crypter.
Definition aes.hxx:64
Camellia-CBC crypter.
Definition camellia.hxx:64
ChaCha20-Poly1305 crypter.
Definition chachapoly.hxx:64
Elliptic-curve crypter.
Definition ecc.hxx:65
Abstract crypter.
Definition generic.hxx:85
bool Decrypt(std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
Decrypt a byte span.
Definition generic.hxx:194
virtual Buffer::Consumer DoEncrypt(Buffer::Consumer consumer, ReadMode mode) const noexcept=0
Encrypt a Consumer.
bool Encrypt(const Range &input, Buffer::WriteOnly &output) const
Encrypt an input range of byte-convertible values.
Definition generic.hxx:145
Buffer::Consumer Encrypt(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Encrypt a Consumer into another Consumer.
Definition generic.hxx:179
bool Encrypt(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Encrypt a read-only buffer (copy).
Definition generic.hxx:159
virtual bool DoDecrypt(std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept=0
Decrypt a byte span.
bool Decrypt(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Decrypt a buffer, consuming it.
Definition generic.hxx:230
bool Decrypt(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Decrypt a read-only buffer (copy).
Definition generic.hxx:220
bool Encrypt(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Encrypt a buffer, consuming it.
Definition generic.hxx:169
Generic(const Generic &other)=default
Copy constructor.
enum Type m_type
Cipher.
Definition generic.hxx:254
Generic(Generic &&other) noexcept=default
Move constructor.
enum Type Type() const noexcept
Cipher of this crypter.
Definition generic.hxx:249
Generic(enum Type type)
Construct with a cipher.
Definition generic.hxx:260
Buffer::Consumer Decrypt(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Decrypt a Consumer into another Consumer.
Definition generic.hxx:240
virtual Buffer::Consumer DoDecrypt(Buffer::Consumer consumer, ReadMode mode) const noexcept=0
Decrypt a Consumer.
bool Decrypt(const Range &input, Buffer::WriteOnly &output) const
Decrypt an input range of byte-convertible values.
Definition generic.hxx:206
virtual bool DoEncrypt(std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept=0
Encrypt a byte span.
virtual ~Generic() noexcept
Destructor.
RSA crypter.
Definition rsa.hxx:65
Serpent-CBC crypter.
Definition serpent.hxx:64
Twofish-CBC crypter.
Definition twofish.hxx:64
ReadMode
How a source buffer is consumed.
Definition typedefs.hxx:57
Root namespace of the StormByte suite.
#define STORMBYTE_CRYPTO_PUBLIC
Definition visibility.h:53