30 explicit Sha1Sum(std::string_view hex);
37 [[nodiscard]] std::string
toString()
const;
40 [[nodiscard]]
bool empty()
const;
45 if (a[i] != other.a[i])
return false;
51 for (
int i :
xrange(5 - 1)) {
52 if (a[i] != other.a[i])
return a[i] < other.a[i];
54 return a[5 - 1] < other.a[5 - 1];
96 void transform(
const uint8_t buffer[64]);
102 uint8_t m_buffer[64];
Helper class to perform a sha1 calculation.
Sha1Sum digest()
Get the final hash.
void update(span< const uint8_t > data)
Incrementally calculate the hash value.
static Sha1Sum calc(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).
friend std::ostream & operator<<(std::ostream &os, const Sha1Sum &sum)
bool operator==(const Sha1Sum &other) const
bool operator<=(const Sha1Sum &other) const
Sha1Sum(UninitializedTag)
bool operator<(const Sha1Sum &other) const
bool operator!=(const Sha1Sum &other) const
bool operator>(const Sha1Sum &other) const
void parse40(const char *str)
Parse from a 40-character long buffer.
bool operator>=(const Sha1Sum &other) const
std::string toString() const
This file implemented 3 utility functions:
auto sum(InputRange &&range)
constexpr auto xrange(T e)