LibCrypto: Add equality operators for Crypto::Hash::Digest<>

This commit is contained in:
Nico Weber 2023-01-04 15:32:43 -05:00 committed by Andreas Kling
parent 7080aac84f
commit fafacbb87b
Notes: sideshowbarker 2024-07-17 23:00:03 +09:00

View file

@ -23,6 +23,9 @@ struct Digest {
[[nodiscard]] ALWAYS_INLINE size_t data_length() const { return Size; }
[[nodiscard]] ALWAYS_INLINE ReadonlyBytes bytes() const { return { immutable_data(), data_length() }; }
[[nodiscard]] bool operator==(Digest const& other) const { return memcmp(data, other.data, sizeof(data)) == 0; }
[[nodiscard]] bool operator!=(Digest const& other) const { return !(*this == other); }
};
template<size_t BlockS, size_t DigestS, typename DigestT = Digest<DigestS>>