subtle icon indicating copy to clipboard operation
subtle copied to clipboard

Support for constant-time ordering comparisons?

Open gendx opened this issue 5 years ago • 1 comments
trafficstars

For now, the library only supports constant-time equality comparison.

Could it be extended to support constant-time ordering comparisons (https://doc.rust-lang.org/std/cmp/trait.Ord.html)? In particular for slices of the same length (using lexicographical comparison).

One application would be private key generation for curves like P-256 using rejection sampling, where the rejection requires an ordering comparison between the generated secret and the curve order.

I'm not sure whether it would make sense to extend the Choice type to support three states, or to just expose a less-than API returning a boolean choice.

gendx avatar Nov 28 '19 09:11 gendx

Backreference: #20 -- as yet there hasn't been a compelling use-case for this functionality.

hdevalence avatar Dec 05 '19 21:12 hdevalence

This should be available now as of #102

isislovecruft avatar Feb 28 '23 18:02 isislovecruft