BLAKE3
BLAKE3 copied to clipboard
Implement constant-time hash ordering
This PR implements constant-time ordering (and partial ordering) for Hash
, but does so differently than #267 and #370.
It uses subtle
internally to lexicographically compare corresponding bytes, being careful not to short circuit. This simplifies the logic considerably.
Note that it does not use subtle
to implement PartialEq
; this functionality exists in #419 since it seemed better scoped for a separate PR. However, if #419 is implemented, it will be possible to implement ConstantTimeGreater
and ConstantTimeLess
due to the latter requiring a ConstantTimeEq
trait bound included in that PR.