status-im / nim-blscurve

Nim implementation of BLS signature scheme (Boneh-Lynn-Shacham) over Barreto-Lynn-Scott (BLS) curve BLS12-381
Apache License 2.0
26 stars 11 forks source link

Signature parsing issue #29

Closed mratsim closed 4 years ago

mratsim commented 4 years ago

The following signature is extracted from SSZ consensus test:

import blscurve

let sigbytes = @[byte 217, 149, 255, 97, 73, 133, 236, 43, 248, 34, 30, 10, 15, 45, 82, 72, 243, 179, 53, 17, 27, 17, 248, 180, 7, 92, 200, 153, 11, 3, 111, 137, 124, 171, 29, 218, 191, 246, 148, 57, 160, 50, 232, 129, 81, 90, 72, 161, 110, 138, 243, 116, 0, 88, 125, 180, 67, 153, 194, 181, 117, 152, 166, 147, 13, 77, 15, 91, 33, 50, 140, 199, 150, 10, 15, 10, 209, 165, 38, 57, 56, 114, 175, 29, 49, 11, 11, 126, 55, 189, 170, 46, 218, 240, 189, 144]

var sig: Signature

let success = init(sig, sigbytes)

echo success
echo sig

It results in

true
c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Instead of the expected

true
0xd995ff614985ec2bf8221e0a0f2d5248f3b335111b11f8b4075cc8990b036f897cab1ddabff69439a032e881515a48a16e8af37400587db44399c2b57598a6930d4d0f5b21328cc7960a0f0ad1a526393872af1d310b0b7e37bdaa2edaf0bd90
mratsim commented 4 years ago

False alarm. The EF tests again have seemingly valid signatures but they always use blobs for testing.