]>
Commit | Line | Data |
---|---|---|
10e5357e PW |
1 | // Copyright (c) 2017 Pieter Wuille |
2 | // Distributed under the MIT software license, see the accompanying | |
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
4 | ||
5 | // Bech32 is a string encoding format used in newer address types. | |
6 | // The output consists of a human-readable part (alphanumeric), a | |
7 | // separator character (1), and a base32 data section, the last | |
8 | // 6 characters of which are a checksum. | |
9 | // | |
10 | // For more information, see BIP 173. | |
11 | ||
768cd14c JG |
12 | #ifndef BITCOIN_BECH32_H |
13 | #define BITCOIN_BECH32_H | |
14 | ||
10e5357e PW |
15 | #include <stdint.h> |
16 | #include <string> | |
17 | #include <vector> | |
18 | ||
19 | namespace bech32 | |
20 | { | |
21 | ||
22 | /** Encode a Bech32 string. Returns the empty string in case of failure. */ | |
23 | std::string Encode(const std::string& hrp, const std::vector<uint8_t>& values); | |
24 | ||
25 | /** Decode a Bech32 string. Returns (hrp, data). Empty hrp means failure. */ | |
26 | std::pair<std::string, std::vector<uint8_t>> Decode(const std::string& str); | |
27 | ||
28 | } // namespace bech32 | |
768cd14c JG |
29 | |
30 | #endif // BITCOIN_BECH32_H |