131 inline
bool Hash(
std::span<const
std::
byte> input, Buffer::WriteOnly& output) const noexcept {
132 return DoHash(input, output);
142 template<StormByte::Type::ByteInputRange Range>
145 for (
const auto value: input) {
148 return Hash(std::span<const std::byte>(data), output);
158 return DoHash(
const_cast<Buffer::ReadOnly&
>(input), output, ReadMode::Copy);
168 return DoHash(input, output, ReadMode::Move);
178 return DoHash(consumer, mode);
216 virtual bool DoHash(std::span<const std::byte> input,
Buffer::WriteOnly& output)
const noexcept = 0;
reference emplace_back(T &&value)
BLAKE2b hasher.
Definition blake2b.hxx:64
BLAKE2s hasher.
Definition blake2s.hxx:64
Abstract hasher.
Definition generic.hxx:83
bool Hash(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Hash a read-only buffer (copy).
Definition generic.hxx:157
bool Hash(const Range &input, Buffer::WriteOnly &output) const
Hash an input range of byte-convertible values.
Definition generic.hxx:143
Generic(Generic &&other) noexcept=default
Move constructor.
enum Type m_type
Algorithm.
Definition generic.hxx:191
virtual ~Generic() noexcept
Destructor.
enum Type Type() const noexcept
Algorithm of this hasher.
Definition generic.hxx:185
Buffer::Consumer Hash(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Hash a Consumer into another Consumer.
Definition generic.hxx:177
bool Hash(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Hash a buffer, consuming it.
Definition generic.hxx:167
Generic(enum Type type)
Construct with an algorithm.
Definition generic.hxx:197
Generic(const Generic &other)=default
Copy constructor.
SHA-256 hasher.
Definition sha256.hxx:64
SHA3-256 hasher.
Definition sha3_256.hxx:64
SHA3-512 hasher.
Definition sha3_512.hxx:64
SHA-512 hasher.
Definition sha512.hxx:64
Generic::PointerType Create(Type type) noexcept
Factory for a hasher.
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