43#include <StormByte/buffer/consumer.hxx>
46#include <StormByte/safe/binary.hxx>
47#include <StormByte/safe/clonable.hxx>
48#include <StormByte/type_traits.hxx>
49#include <StormByte/type_traits/safe.hxx>
140 inline
bool Hash(
std::span<const
std::
byte> input,
Buffer::WriteOnly& output) const noexcept {
141 return DoHash(input, output);
151 template<StormByte::Type::ByteInputRange Range>
154 for (
const auto value: input)
155 data.
push_back(
static_cast<std::byte
>(value));
156 return Hash(std::span<const std::byte>{data.
span()}, output);
186 return DoHash(consumer, mode);
224 virtual bool DoHash(std::span<const std::byte> input,
Buffer::WriteOnly& output)
const noexcept = 0;
BLAKE2b hasher.
Definition blake2b.hxx:66
BLAKE2s hasher.
Definition blake2s.hxx:66
Abstract hasher.
Definition generic.hxx:92
bool Hash(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Hash a read-only buffer (copy).
Definition generic.hxx:165
bool Hash(const Range &input, Buffer::WriteOnly &output) const
Hash an input range of byte-convertible values.
Definition generic.hxx:152
Generic(Generic &&other) noexcept=default
Move constructor.
enum Type m_type
Algorithm.
Definition generic.hxx:199
virtual ~Generic() noexcept
Destructor.
bool Hash(std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
Hash a byte span into an output buffer.
Definition generic.hxx:140
enum Type Type() const noexcept
Algorithm of this hasher.
Definition generic.hxx:193
Buffer::Consumer Hash(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Hash a Consumer into another Consumer.
Definition generic.hxx:185
bool Hash(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Hash a buffer, consuming it.
Definition generic.hxx:175
Generic(enum Type type)
Construct with an algorithm.
Definition generic.hxx:205
Generic(const Generic &other)=default
Copy constructor.
SHA-256 hasher.
Definition sha256.hxx:66
SHA3-256 hasher.
Definition sha3_256.hxx:66
SHA3-512 hasher.
Definition sha3_512.hxx:66
SHA-512 hasher.
Definition sha512.hxx:66
STORMBYTE_FORCE_INLINE std::span< std::byte > span() noexcept
void push_back(std::byte value)
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
Hash algorithms of the Crypto module.
Generic::PointerType Create(Type type) noexcept
Factory for a hasher.
Crypto module of the StormByte suite.
Definition aead.hxx:53
ReadMode
How a source buffer is consumed.
Definition typedefs.hxx:57
@ Copy
Copy the input.
Definition typedefs.hxx:58
@ Move
Consume the input.
Definition typedefs.hxx:59
Root namespace of the StormByte suite.
#define STORMBYTE_CRYPTO_PUBLIC
Definition visibility.h:53