StormByte C++ Library: Crypto module 1.0.0
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
hasher.hxx
1#pragma once
2
3#include <StormByte/buffer/consumer.hxx>
4#include <StormByte/crypto/algorithm.hxx>
5#include <StormByte/crypto/exception.hxx>
6#include <StormByte/expected.hxx>
7
8#include <string>
9
14namespace StormByte::Crypto {
21 class STORMBYTE_CRYPTO_PUBLIC Hasher final {
22 public:
27 explicit Hasher(const Algorithm::Hash& algorithm) noexcept;
28
33 Hasher(const Hasher& hasher) = default;
34
39 Hasher(Hasher&& hasher) noexcept = default;
40
44 ~Hasher() noexcept = default;
45
51 Hasher& operator=(const Hasher& hasher) = default;
52
58 Hasher& operator=(Hasher&& hasher) noexcept = default;
59
65 [[nodiscard]]
66 Expected<std::string, Exception> Hash(const std::string& input) const noexcept;
67
73 [[nodiscard]]
74 Expected<std::string, Exception> Hash(const Buffer::Simple& buffer) const noexcept;
75
81 [[nodiscard]]
82 Buffer::Consumer Hash(const Buffer::Consumer consumer) const noexcept;
83
84 private:
85 const Algorithm::Hash m_algorithm;
86 };
87}
A class representing an exception in the crypto module.
Definition exception.hxx:15
A class for managing hashing operations.
Definition hasher.hxx:21
Hasher(const Algorithm::Hash &algorithm) noexcept
Initializes a Hasher instance with the specified hashing algorithm.
~Hasher() noexcept=default
Destructor for the Hasher class.
Hasher(Hasher &&hasher) noexcept=default
Move constructor for the Hasher class.
Hasher(const Hasher &hasher)=default
Copy constructor for the Hasher class.
The namespace containing cryptographic algorithms.