Several places in wnaf.rs, PrimeField::to_repr is called on scalars assuming this outputs a little endian serialization. That method is documented as follows:
/// The endianness of the byte representation is implementation-specific. Generic
/// encodings of field elements should be treated as opaque.
We are using the big endian SEC1 serialization of scalars for our implementations of the NIST P-curves as well as secp256k1.
It would be nice to eliminate the endianness assumptions in the implementation. As a hack we added a secondary method which always provides a little endian serialization to PrimeField in rustcrypto-ff, but whatever can eliminate the endianness assumptions here would be nice. Perhaps something that constructs an Iterator over the bits of the scalar in little endian order would be generally useful?
Several places in
wnaf.rs,PrimeField::to_repris called on scalars assuming this outputs a little endian serialization. That method is documented as follows:We are using the big endian SEC1 serialization of scalars for our implementations of the NIST P-curves as well as secp256k1.
It would be nice to eliminate the endianness assumptions in the implementation. As a hack we added a secondary method which always provides a little endian serialization to
PrimeFieldinrustcrypto-ff, but whatever can eliminate the endianness assumptions here would be nice. Perhaps something that constructs anIteratorover the bits of the scalar in little endian order would be generally useful?