diff options
| author | Jack O'Connor <[email protected]> | 2021-02-28 17:50:06 -0500 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2021-02-28 17:50:06 -0500 |
| commit | 134bb24686f9a1cd02ad12fdf22a72d9c1071220 (patch) | |
| tree | d53e536aa2b42da6286d7cb5d270aae227c53978 | |
| parent | 0359065018e2bafa31d319010ec5cebc35ad4393 (diff) | |
impl PartialEq<[u8]> for Hash
| -rw-r--r-- | src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -293,6 +293,14 @@ impl PartialEq<[u8; OUT_LEN]> for Hash { } } +/// This implementation is constant-time if the target is 32 bytes long. +impl PartialEq<[u8]> for Hash { + #[inline] + fn eq(&self, other: &[u8]) -> bool { + constant_time_eq::constant_time_eq(&self.0, other) + } +} + impl Eq for Hash {} impl fmt::Debug for Hash { |
