nbd-wtf / dart-bip340

naïve implementation of BIP-340 Schnorr Signatures in Dart
MIT License
14 stars 10 forks source link

Verify error #5

Closed shanelau closed 1 year ago

shanelau commented 1 year ago
  String public =
      '0000a0fa65fcccd99e6fd32fc7870339af40f4a94703ea30999fc5c091daa222';
  String message =
      '3518d08e684f4b94a68367a060a9075dc0b5d1058f87bcc6b6bc9e676b9f2c71';
  String sig =
    '637d91a9f93fd4a6b71ed3a542a9159ed58dc63bfaa319d834f59f158851e28803f54c9e89c26edcf1942819fd4571bc891874318a84d3e387755d4cf113ed38';

const result  = bip340.verify(public, message, sig);
result  === false

The is an error and I think it's because my account number starts with 0000. When I switched to another account, verification succeeded.

However, when I switched to a different library, there was no error: bip-schnorr. This library will return the correct validation results.

ryzizub commented 1 year ago

Yeah seems that public keys that starts with zeros have issues in this library. Generating signatures are also a problem here.

Testing private key nsec1dwt55gfuryx9mmmqv9g3skasxmvsv89h4f525pzyu53rvj07d3jqqu37wm

ryzizub commented 1 year ago

Fixed this in #6