1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:28:13 +00:00

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

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>>