From b0ef329498155bf8b87a41ec1a2f1b1e8fdc77a4 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 24 Aug 2017 16:39:47 -0700 Subject: [PATCH 1/2] Add extra test cases to BIP173 --- bip-0173.mediawiki | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bip-0173.mediawiki b/bip-0173.mediawiki index 0c911b4f..e96777e5 100644 --- a/bip-0173.mediawiki +++ b/bip-0173.mediawiki @@ -268,6 +268,16 @@ The following strings have a valid Bech32 checksum. * 11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j * split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w +The following strings have an invalid Bech32 checksum (with reason for invalidity): +* 0x20 + 1nwldj5: HRP character out of range +* 0x7F + 1axkwrx: HRP character out of range +* an84characterslonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1569pvx: overall max length exceeded +* pzry9x0s0muk: No separator character +* 1pzry9x0s0muk: Empty HRP +* x1b4n0q5v: Invalid data character +* li1dgmt3: Too short checksum +* de1lg7wt + 0xFF: Invalid character in checksum + The following list gives valid segwit addresses and the scriptPubKey that they translate to in hex. * BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4: 0014751e76e8199196d454941c45d1b3a323f1433bd6 @@ -286,8 +296,9 @@ their invalidity. * bc10w508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kw5rljs90: Invalid program length * BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P: Invalid program length for witness version 0 (per BIP141) * tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sL5k7: Mixed case -* tb1pw508d6qejxtdg4y5r3zarqfsj6c3: zero padding of more than 4 bits +* bc1zw508d6qejxtdg4y5r3zarvaryvqyzf3du: zero padding of more than 4 bits * tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3pjxtptv: Non-zero padding in 8-to-5 conversion +* bc1gmk9yu: Empty data section ===Checksum design=== From 199404e96df459f5a8be6517c0addb27c3adfbff Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 24 Aug 2017 17:02:54 -0700 Subject: [PATCH 2/2] Add C++ reference --- bip-0173.mediawiki | 1 + 1 file changed, 1 insertion(+) diff --git a/bip-0173.mediawiki b/bip-0173.mediawiki index e96777e5..425b8d70 100644 --- a/bip-0173.mediawiki +++ b/bip-0173.mediawiki @@ -247,6 +247,7 @@ P2PKH addresses can be used. * Reference encoder and decoder: ** [https://github.com/sipa/bech32/tree/master/ref/c For C] +** [https://github.com/sipa/bech32/tree/master/ref/c++ For C++] ** [https://github.com/sipa/bech32/tree/master/ref/javascript For JavaScript] ** [https://github.com/sipa/bech32/tree/master/ref/go For Go] ** [https://github.com/sipa/bech32/tree/master/ref/python For Python]