Files
bips/bip-0327/vectors
Jonas Nick 17affe2861 bip-0327: add test vectors for a public key and its negation
A public key and its negation have the same X coordinate, and their
compressed encodings differ only in the first byte. Add a Sign test
vector with a secnonce generated for the negation of the signer's public
key, and a KeyAgg test vector with a public key and its negation. They
detect implementations that compare public keys only by their X
coordinates, in the public key check of Sign, in GetSecondKey, or in
KeyAggCoeffInternal. Distinct public keys in the previous test vectors
also have distinct X coordinates.

The public key check in Sign ensures that the secret key provided to
Sign is determined when NonceGen is invoked. Comparing only X
coordinates determines the secret key only up to negation.
2026-11-16 09:29:52 +00:00
..

BIP327 test vectors

BIP327 specifies the length and number of the inputs of each algorithm, for example that each tweak is a 32-byte array and that there is one tweak mode for each tweak. The test vectors only contain inputs that meet these specifications. Since BIP327 does not specify how algorithms handle other inputs, such as a 31-byte tweak or a missing tweak mode, the test vectors do not test them.

A test vector should only be added if it detects a plausible implementation mistake that the other test vectors do not detect. The comment of the test vector names the mistake, for example "Detects implementations that set gacc to g instead of multiplying it by g".