@@ -59,12 +59,24 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
59
59
}
60
60
61
61
BOOST_CHECK (!DecodeBase58 (" invalid" , result, 100 ));
62
+ BOOST_CHECK (!DecodeBase58 (std::string (" invalid" ), result, 100 ));
63
+ BOOST_CHECK (!DecodeBase58 (std::string (" \0 invalid" , 8 ), result, 100 ));
64
+
65
+ BOOST_CHECK (DecodeBase58 (std::string (" good" , 4 ), result, 100 ));
66
+ BOOST_CHECK (!DecodeBase58 (std::string (" bad0IOl" , 7 ), result, 100 ));
67
+ BOOST_CHECK (!DecodeBase58 (std::string (" goodbad0IOl" , 11 ), result, 100 ));
68
+ BOOST_CHECK (!DecodeBase58 (std::string (" good\0 bad0IOl" , 12 ), result, 100 ));
62
69
63
70
// check that DecodeBase58 skips whitespace, but still fails with unexpected non-whitespace at the end.
64
71
BOOST_CHECK (!DecodeBase58 (" \t\n\v\f\r skip \r\f\v\n\t a" , result, 3 ));
65
72
BOOST_CHECK ( DecodeBase58 (" \t\n\v\f\r skip \r\f\v\n\t " , result, 3 ));
66
73
std::vector<unsigned char > expected = ParseHex (" 971a55" );
67
74
BOOST_CHECK_EQUAL_COLLECTIONS (result.begin (), result.end (), expected.begin (), expected.end ());
75
+
76
+ BOOST_CHECK (DecodeBase58Check (std::string (" 3vQB7B6MrGQZaxCuFg4oh" , 21 ), result, 100 ));
77
+ BOOST_CHECK (!DecodeBase58Check (std::string (" 3vQB7B6MrGQZaxCuFg4oi" , 21 ), result, 100 ));
78
+ BOOST_CHECK (!DecodeBase58Check (std::string (" 3vQB7B6MrGQZaxCuFg4oh0IOl" , 25 ), result, 100 ));
79
+ BOOST_CHECK (!DecodeBase58Check (std::string (" 3vQB7B6MrGQZaxCuFg4oh\00 IOl" , 26 ), result, 100 ));
68
80
}
69
81
70
82
BOOST_AUTO_TEST_CASE (base58_random_encode_decode)
0 commit comments