Make DecodeBase{32,64} return optional instead of taking bool*

This commit is contained in:
Pieter Wuille
2022-04-04 13:52:06 -04:00
committed by MacroFake
parent a65931e3ce
commit 78f3ac51b7
11 changed files with 57 additions and 77 deletions

View File

@@ -64,13 +64,13 @@ bool IsHex(std::string_view str);
* Return true if the string is a hex number, optionally prefixed with "0x"
*/
bool IsHexNumber(std::string_view str);
std::vector<unsigned char> DecodeBase64(const char* p, bool* pf_invalid);
std::vector<unsigned char> DecodeBase64(const std::string& str, bool* pf_invalid);
std::optional<std::vector<unsigned char>> DecodeBase64(const char* p);
std::optional<std::vector<unsigned char>> DecodeBase64(const std::string& str);
std::string EncodeBase64(Span<const unsigned char> input);
inline std::string EncodeBase64(Span<const std::byte> input) { return EncodeBase64(MakeUCharSpan(input)); }
inline std::string EncodeBase64(const std::string& str) { return EncodeBase64(MakeUCharSpan(str)); }
std::vector<unsigned char> DecodeBase32(const char* p, bool* pf_invalid);
std::vector<unsigned char> DecodeBase32(const std::string& str, bool* pf_invalid);
std::optional<std::vector<unsigned char>> DecodeBase32(const char* p);
std::optional<std::vector<unsigned char>> DecodeBase32(const std::string& str);
/**
* Base32 encode.