31 explicit Sha1Sum(std::string_view hex);
37 void parse40(std::span<const char, 40> str);
38 [[nodiscard]] std::string
toString()
const;
41 [[nodiscard]]
bool empty()
const;
49 if (a[i] != other.a[i])
return false;
54 for (
int i :
xrange(5 - 1)) {
55 if (
auto cmp = a[i] <=> other.a[i]; cmp != 0)
return cmp;
57 return a[5 - 1] <=> other.a[5 - 1];
66 std::array<uint32_t, 5> a;
85 void update(std::span<const uint8_t> data);
92 [[nodiscard]]
static Sha1Sum calc(std::span<const uint8_t> data);
95 void transform(std::span<const uint8_t, 64> buffer);
101 std::array<uint8_t, 64> m_buffer;
102 bool m_finalized =
false;
Helper class to perform a sha1 calculation.
Sha1Sum digest()
Get the final hash.
void update(std::span< const uint8_t > data)
Incrementally calculate the hash value.
static Sha1Sum calc(std::span< const uint8_t > data)
Easier to use interface, if you can pass all data in one go.
This class represents the result of a sha1 calculation (a 160-bit value).
bool operator==(const Sha1Sum &other) const
Sha1Sum(UninitializedTag)
void parse40(std::span< const char, 40 > str)
Parse from a 40-character long buffer.
constexpr auto operator<=>(const Sha1Sum &other) const
friend std::ostream & operator<<(std::ostream &os, const Sha1Sum &sum)
std::string toString() const
This file implemented 3 utility functions:
auto sum(InputRange &&range, Proj proj={})
constexpr auto xrange(T e)