mirror of
https://github.com/bitcoin/bips.git
synced 2026-11-16 19:48:35 +00:00
Add Sign test vectors with k2' = n and k2' = n + 1. Together they detect implementations that check the secret nonce values only for zero, that check k2' <= n instead of k2' < n, or that reduce k2' mod n before checking it for zero. No single value detects the last two: among values of at least n, checking k2' <= n accepts only n, while reducing first rejects only n. For k2' = n, the optional correctness check at the end of Sign also fails, because k2'*G is infinity, so this vector detects the k2' <= n mistake only in implementations that omit that check. Add NonceGen and DeterministicSign test vectors with a 256-byte message. They detect implementations that encode only the low byte of len(m); the longest message in the previous test vectors has 38 bytes. DeterministicSign needs its own vector because it encodes len(m) separately.