Add test that the computed value encodes correctly

This commit is contained in:
Henry de Valence 2019-04-19 13:22:02 -07:00
parent 5140be0fdf
commit 4e51bef1ad
1 changed files with 5 additions and 0 deletions

View File

@ -153,6 +153,11 @@ func TestRistrettoSmallMultiplesTestVectors(t *testing.T) {
if basepointMultiple.Equal(&decodedPoint) != 1 {
t.Errorf("decoded small multiple %d * B is not %d * B", i, i)
}
computedEncoding := basepointMultiple.Encode(nil)
if !bytes.Equal(encoding, computedEncoding) {
t.Errorf("#%d: encoding computed value did not match", i)
}
// Ensure basepointMultiple = i * B in the next iteration
basepointMultiple.Add(&basepointMultiple, &ristrettoBasepoint)
}