muu::sha1 class

SHA-1 hasher.

sha1 hasher;
hasher("The quick brown fox jumps over the lazy dog"sv);
hasher.finish();
std::cout << hasher << std::endl;
2fd4e1c67a2d28fced849ee1bb76e7391b93eb12

Constructors, destructors, conversion operators

sha1() noexcept
Constructs a new SHA-1 hasher.

Public functions

auto finish() -> sha1& noexcept
Finishes calculating the hash.
auto operator()(uint8_t byte) -> sha1& noexcept
Appends a single byte to the hash function's input.
auto operator()(std::byte byte) -> sha1& noexcept
Appends a single byte to the hash function's input.
auto operator()(const void* data, size_t size) -> sha1& noexcept
Appends a sequence of raw data to the hash function's input.
auto operator()(std::string_view str) -> sha1& noexcept
Appends a string to the hash function's input.
auto operator()(std::wstring_view str) -> sha1& noexcept
Appends a wide string to the hash function's input.
auto operator()(std::u32string_view str) -> sha1& noexcept
Appends a UTF-32 string to the hash function's input.
auto operator()(std::u16string_view str) -> sha1& noexcept
Appends a UTF-16 string to the hash function's input.
auto operator()(std::u8string_view str) -> sha1& noexcept
Appends a UTF-8 string to the hash function's input.
auto value() const -> const hash_type& noexcept
Returns the calculated hash value.

Friends

template <typename Char, typename Traits>
auto operator<<(std::basic_ostream<Char, Traits>& lhs, const sha1& rhs) -> std::basic_ostream<Char, Traits>&
Writes an SHA-1 hash to a text stream.

Function documentation

sha1& muu::sha1::finish() noexcept

Finishes calculating the hash.

Appending to the hash function's input has no effect after finish() is called.

const hash_type& muu::sha1::value() const noexcept

Returns the calculated hash value.

template <typename Char, typename Traits>
std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& lhs, const sha1& rhs)

Writes an SHA-1 hash to a text stream.