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

Function VerifyChecksum

src/bech32.cpp:118–125  ·  view source on GitHub ↗

Verify a checksum. */

Source from the content-addressed store, hash-verified

116
117/** Verify a checksum. */
118bool VerifyChecksum(const std::string& hrp, const data& values)
119{
120 // PolyMod computes what value to xor into the final values to make the checksum 0. However,
121 // if we required that the checksum was 0, it would be the case that appending a 0 to a valid
122 // list of values would result in a new valid list. For that reason, Bech32 requires the
123 // resulting checksum to be 1 instead.
124 return PolyMod(Cat(ExpandHRP(hrp), values)) == 1;
125}
126
127/** Create a checksum. */
128data CreateChecksum(const std::string& hrp, const data& values)

Callers 1

DecodeFunction · 0.85

Calls 3

PolyModFunction · 0.85
CatFunction · 0.85
ExpandHRPFunction · 0.85

Tested by

no test coverage detected