mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Make DecodeBase{32,64} always return vector, not string
Base32/base64 are mechanisms for encoding binary data. That they'd decode to a string is just bizarre. The fact that they'd do that based on the type of input arguments even more so.
This commit is contained in:
@@ -37,16 +37,16 @@ FUZZ_TARGET_INIT(base_encode_decode, initialize_base_encode_decode)
|
||||
}
|
||||
|
||||
bool pf_invalid;
|
||||
std::string decoded_string = DecodeBase32(random_encoded_string, &pf_invalid);
|
||||
decoded = DecodeBase32(random_encoded_string, &pf_invalid);
|
||||
if (!pf_invalid) {
|
||||
const std::string encoded_string = EncodeBase32(decoded_string);
|
||||
const std::string encoded_string = EncodeBase32(decoded);
|
||||
assert(encoded_string == TrimString(encoded_string));
|
||||
assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string)));
|
||||
}
|
||||
|
||||
decoded_string = DecodeBase64(random_encoded_string, &pf_invalid);
|
||||
decoded = DecodeBase64(random_encoded_string, &pf_invalid);
|
||||
if (!pf_invalid) {
|
||||
const std::string encoded_string = EncodeBase64(decoded_string);
|
||||
const std::string encoded_string = EncodeBase64(decoded);
|
||||
assert(encoded_string == TrimString(encoded_string));
|
||||
assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user