MCPcopy Create free account
hub / github.com/ElementsProject/elements / ExpandHRP

Function ExpandHRP

src/blech32.cpp:128–140  ·  view source on GitHub ↗

Expand a HRP for use in checksum computation. */

Source from the content-addressed store, hash-verified

126
127/** Expand a HRP for use in checksum computation. */
128data ExpandHRP(const std::string& hrp)
129{
130 data ret;
131 ret.reserve(hrp.size() + 90);
132 ret.resize(hrp.size() * 2 + 1);
133 for (size_t i = 0; i < hrp.size(); ++i) {
134 unsigned char c = hrp[i];
135 ret[i] = c >> 5;
136 ret[i + hrp.size() + 1] = c & 0x1f;
137 }
138 ret[hrp.size()] = 0;
139 return ret;
140}
141
142/** Verify a checksum. */
143Encoding VerifyChecksum(const std::string& hrp, const data& values)

Callers 2

VerifyChecksumFunction · 0.70
CreateChecksumFunction · 0.70

Calls 3

reserveMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected