BLAKE3 icon indicating copy to clipboard operation
BLAKE3 copied to clipboard

Implement constant-time hash ordering

Open AaronFeickert opened this issue 6 months ago • 1 comments

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.

AaronFeickert avatar Aug 21 '24 17:08 AaronFeickert