bip-0327: add a NonceGen test vector without repeated bytes

In the previous NonceGen test vectors, every rand_ consists of the byte
0F repeated 32 times, every present sk of the byte 02 repeated 32 times,
and every pk has an even Y coordinate. Add a test vector whose rand_ and
sk are not a repeated byte and whose pk has an odd Y coordinate. It
detects implementations that reverse the byte order of rand_ or sk, that
replace the first byte of pk with 02, or that use only the first byte of
rand_.

With the last mistake, two NonceGen invocations with the same other
arguments return the same secnonce with probability 1/256, although the
BIP requires that Sign is never executed twice with the same secnonce.
This commit is contained in:
Jonas Nick committed 2026-11-16 09:29:52 +00:00
1 parent 17affe2861
commit b7557f897a
1 file changed
+11
+11
View File
@@ -61,6 +61,17 @@
"expected_secnonce": "A7DA22BD150F412D85E5DB863DE9E3DB3BD1185AC3EFBB2C187EB6385140DC9F979ABE5529FDA821A31081A521687C6D95C940F34FD7F088129A4599025E960D024D4B6CD1361032CA9BD2AEB9D900AA4D45D9EAD80AC9423374C451A7254D0766",
"expected_pubnonce": "029AE00806C1C5D4650A86BD252B71360BCB46CB8F55E25F1D1963EF2E63BA10CF0394C3255F45ED9271C49ECE4B92F6863344E169206FFC2158036AB102BED040E8",
"comment": "Message of 256 bytes. Detects implementations that encode only the low byte of the message length."
},
{
"rand_": "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F",
"sk": "7FB9E0E687ADA1EEBF7ECFE2F21E73EBDB51A7D450948DFE8D76D7F2D1007671",
"pk": "03935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
"aggpk": "0707070707070707070707070707070707070707070707070707070707070707",
"msg": "0101010101010101010101010101010101010101010101010101010101010101",
"extra_in": "0808080808080808080808080808080808080808080808080808080808080808",
"expected_secnonce": "E739C0DDB9673209EE2E80C0DFEEAA7C230B8672BA1D2D5AD8460FFBAEA35B2A4435BF6BA90D5714EDBBCC04129FA89E1F6F2606B13A356E1C71EC8E8325617203935F972DA013F80AE011890FA89B67A27B7BE6CCB24D3274D18B2D4067F261A9",
"expected_pubnonce": "039ACD0A88C7785D3D4E88FC16EFA696B07C590C98D8C052934EBE8F8DF9E92DC00222A70E75E42CFBC98B4C32AF73B1753C0642C9A0A6EA962DBBC77C4B5F813A38",
"comment": "rand_ and sk are not a repeated byte, and pk has an odd Y coordinate. Detects implementations that reverse rand_ or sk, use only the first byte of rand_, or replace the first byte of pk with 02."
}
]
}