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.
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 implementPartialEq
; this functionality exists in #419 since it seemed better scoped for a separate PR. However, if #419 is implemented, it will be possible to implementConstantTimeGreater
andConstantTimeLess
due to the latter requiring aConstantTimeEq
trait bound included in that PR.