From 5ade04e0791b01b7027ef009521066ef077d57b7 Mon Sep 17 00:00:00 2001 From: Eduard S Date: Mon, 9 Dec 2019 12:30:50 +0100 Subject: [PATCH] Test that babyjub pk is always < Q --- babyjub/eddsa_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/babyjub/eddsa_test.go b/babyjub/eddsa_test.go index 547ca76..cf1f50c 100644 --- a/babyjub/eddsa_test.go +++ b/babyjub/eddsa_test.go @@ -25,6 +25,16 @@ func genInputs() (*PrivateKey, *big.Int) { return &k, msg } +func TestPublicKey(t *testing.T) { + var k PrivateKey + for i := 0; i < 256; i++ { + hex.Decode(k[:], []byte{byte(i)}) + } + pk := k.Public() + assert.True(t, pk.X.Cmp(constants.Q) == -1) + assert.True(t, pk.Y.Cmp(constants.Q) == -1) +} + func TestSignVerifyMimc7(t *testing.T) { var k PrivateKey hex.Decode(k[:], []byte("0001020304050607080900010203040506070809000102030405060708090001"))