MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / ExpandHRP

Function ExpandHRP

src/bech32.cpp:103–115  ·  view source on GitHub ↗

Expand a HRP for use in checksum computation. */

Source from the content-addressed store, hash-verified

101
102/** Expand a HRP for use in checksum computation. */
103data ExpandHRP(const std::string& hrp)
104{
105 data ret;
106 ret.reserve(hrp.size() + 90);
107 ret.resize(hrp.size() * 2 + 1);
108 for (size_t i = 0; i < hrp.size(); ++i) {
109 unsigned char c = hrp[i];
110 ret[i] = c >> 5;
111 ret[i + hrp.size() + 1] = c & 0x1f;
112 }
113 ret[hrp.size()] = 0;
114 return ret;
115}
116
117/** Verify a checksum. */
118bool VerifyChecksum(const std::string& hrp, const data& values)

Callers 2

VerifyChecksumFunction · 0.85
CreateChecksumFunction · 0.85

Calls 3

reserveMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected