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

Function ExpandHRP

src/bech32.cpp:309–321  ·  view source on GitHub ↗

Expand a HRP for use in checksum computation. */

Source from the content-addressed store, hash-verified

307
308/** Expand a HRP for use in checksum computation. */
309data ExpandHRP(const std::string& hrp)
310{
311 data ret;
312 ret.reserve(hrp.size() + 90);
313 ret.resize(hrp.size() * 2 + 1);
314 for (size_t i = 0; i < hrp.size(); ++i) {
315 unsigned char c = hrp[i];
316 ret[i] = c >> 5;
317 ret[i + hrp.size() + 1] = c & 0x1f;
318 }
319 ret[hrp.size()] = 0;
320 return ret;
321}
322
323/** Verify a checksum. */
324Encoding VerifyChecksum(const std::string& hrp, const data& values)

Callers 3

VerifyChecksumFunction · 0.70
CreateChecksumFunction · 0.70
LocateErrorsFunction · 0.70

Calls 3

reserveMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected