1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-13 17:00:59 +00:00

fix(core,crypto): add more test cases from bip-173

This commit is contained in:
Pavol Rusnak 2021-07-21 11:06:03 +02:00
parent ceaf4da617
commit f740515c85
3 changed files with 14 additions and 0 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ __pycache__/
/build
proto.gv*
.DS_Store
crypto/tests/libtrezor-crypto.so.dSYM/

View File

@ -32,21 +32,27 @@ def segwit_scriptpubkey(witver, witprog):
VALID_CHECKSUM = [
"A12UEL5L",
"a12uel5l",
"an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs",
"abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw",
"11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j",
"split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w",
"?1ezyfcl",
]
INVALID_CHECKSUM = [
" 1nwldj5",
"\x7F" + "1axkwrx",
"\x80" + "1eym55h",
"an84characterslonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1569pvx",
"pzry9x0s0muk",
"1pzry9x0s0muk",
"x1b4n0q5v",
"li1dgmt3",
"de1lg7wt\xff",
"A1G7SGD8",
"10a06t8",
"1qzzfhee",
]
VALID_ADDRESS = [

View File

@ -2,18 +2,22 @@
static const char* valid_checksum[] = {
"A12UEL5L",
"a12uel5l",
"an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedchar"
"actersbio1tt5tgs",
"abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw",
"11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"
"qqqqqqqqqqc8247j",
"split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w",
"?1ezyfcl",
};
static const char* invalid_checksum[] = {
" 1nwldj5",
"\x7f"
"1axkwrx",
"\x80"
"1eym55h"
"an84characterslonghumanreadablepartthatcontainsthenumber1andtheexcludedcha"
"ractersbio1569pvx",
"pzry9x0s0muk",
@ -21,6 +25,9 @@ static const char* invalid_checksum[] = {
"x1b4n0q5v",
"li1dgmt3",
"de1lg7wt\xff",
"A1G7SGD8",
"10a06t8",
"1qzzfhee",
};
struct valid_address_data {