StormByte-Crypto 2.0.0
C++26 cryptography module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Crypto::Hasher::Generic Class Referenceabstract

Abstract hasher. More...

#include <StormByte/crypto/hasher/generic.hxx>

Inheritance diagram for StormByte::Crypto::Hasher::Generic:
Collaboration diagram for StormByte::Crypto::Hasher::Generic:

Public Member Functions

Construction
 Generic (const Generic &other)=default
 Copy constructor.
 
 Generic (Generic &&other) noexcept=default
 Move constructor.
 
virtual ~Generic () noexcept
 Destructor.
 
Generic & operator= (const Generic &other)=default
 Copy assignment.
 
Generic & operator= (Generic &&other) noexcept=default
 Move assignment.
 
Hash
bool Hash (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Hash a byte span into an output buffer.
 
template<StormByte::Type::ByteInputRange Range>
bool Hash (const Range &input, Buffer::WriteOnly &output) const
 Hash an input range of byte-convertible values.
 
bool Hash (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Hash a read-only buffer (copy).
 
bool Hash (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Hash a buffer, consuming it.
 
Buffer::Consumer Hash (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Hash a Consumer into another Consumer.
 
enum Type Type () const noexcept
 Algorithm of this hasher.
 
- Public Member Functions inherited from StormByte::Safe::Clonable< Generic >
constexpr Clonable ()=default
 
constexpr Clonable (const Clonable &)=default
 
constexpr Clonable (Clonable &&) noexcept=default
 
constexpr Clonable & operator= (const Clonable &)=default
 
constexpr Clonable & operator= (Clonable &&) noexcept=default
 
virtual constexpr ~Clonable () noexcept=default
 
virtual PointerType Clone () const =0
 
virtual PointerType Move ()=0
 

Protected Member Functions

 Generic (enum Type type)
 Construct with an algorithm.
 

Protected Attributes

enum Type m_type
 Algorithm.
 

Additional Inherited Members

- Public Types inherited from StormByte::Safe::Clonable< Generic >
typedef SmartPointer PointerType
 
- Static Public Member Functions inherited from StormByte::Safe::Clonable< Generic >
static PointerType MakePointer (Args &&... args)
 

Detailed Description

Abstract hasher.

Concrete algorithms derive from this.

Constructor & Destructor Documentation

◆ Generic() [1/3]

StormByte::Crypto::Hasher::Generic::Generic ( const Generic &  other)
default

Copy constructor.

Parameters
otherHasher to copy.

◆ Generic() [2/3]

StormByte::Crypto::Hasher::Generic::Generic ( Generic &&  other)
defaultnoexcept

Move constructor.

Parameters
otherHasher to move.

◆ ~Generic()

virtual StormByte::Crypto::Hasher::Generic::~Generic ( )
virtualnoexcept

Destructor.

◆ Generic() [3/3]

StormByte::Crypto::Hasher::Generic::Generic ( enum Type  type)
inlineprotected

Construct with an algorithm.

Parameters
typeAlgorithm.

Member Function Documentation

◆ Hash() [1/5]

Buffer::Consumer StormByte::Crypto::Hasher::Generic::Hash ( Buffer::Consumer  consumer,
ReadMode  mode = ReadMode::Move 
) const
inlinenoexcept

Hash a Consumer into another Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with the digest.

◆ Hash() [2/5]

bool StormByte::Crypto::Hasher::Generic::Hash ( Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Hash a buffer, consuming it.

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Hash() [3/5]

bool StormByte::Crypto::Hasher::Generic::Hash ( const Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Hash a read-only buffer (copy).

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Hash() [4/5]

bool StormByte::Crypto::Hasher::Generic::Hash ( const Range &  input,
Buffer::WriteOnly &  output 
) const
inline

Hash an input range of byte-convertible values.

Template Parameters
RangeInput range type.
Parameters
inputInput values.
outputDestination buffer.
Returns
true on success.

◆ Hash() [5/5]

bool StormByte::Crypto::Hasher::Generic::Hash ( std::span< const std::byte >  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Hash a byte span into an output buffer.

Parameters
inputInput bytes.
outputDestination buffer.
Returns
true on success.

◆ operator=() [1/2]

Copy assignment.

Parameters
otherHasher to copy.
Returns
Reference to this hasher.

◆ operator=() [2/2]

Move assignment.

Parameters
otherHasher to move.
Returns
Reference to this hasher.

◆ Type()

enum Type StormByte::Crypto::Hasher::Generic::Type ( ) const
inlinenoexcept

Algorithm of this hasher.

Returns
Hasher type.

Member Data Documentation

◆ m_type

enum Type StormByte::Crypto::Hasher::Generic::m_type
protected

Algorithm.


The documentation for this class was generated from the following file: