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

pull/1581/head
Pavol Rusnak 3 years ago
parent ceaf4da617
commit f740515c85

1
.gitignore vendored

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

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

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

Loading…
Cancel
Save