gtank / ristretto255

Implements ristretto255, a fast prime-order group.
https://ristretto.group
BSD 3-Clause "New" or "Revised" License
98 stars 22 forks source link

Decode error mismatch between Element and Scalar #40

Closed tmthrgd closed 3 years ago

tmthrgd commented 3 years ago

I've noticed a slight mismatch between the Decode methods for Element and for Scalar. For a wrong-length byte slice Element.Decode will return an error, but Scalar.Decode will panic. See https://play.golang.org/p/EcBWChvIIj_v.

It would be nice if Scalar.Decode (really FromCanonicalBytes) would also return an error instead of panicking.

FiloSottile commented 3 years ago

This would be addressed by #36.