arnaucube
arnaucube/go-iden3-cryptoPublic Self-hosted repository
Merge pull request #6 from iden3/feature/testBJPKField

Test that babyjub pk is always < Q
arnau 17317030+arnaucube@users.noreply.github.com
Mon, 09 Dec 2019 15:59:10 +0100
commit

4356f44a3dc3d83ac2c276370e258025fc300b2a

parent

eb7d86c5b363cf4e56f76da9805ec6ef9d1724f4

1 files changed, 10 insertions(+), 0 deletions(-)

jump to
M babyjub/eddsa_test.go → babyjub/eddsa_test.go

@@ -25,6 +25,16 @@

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"))