Expand a HRP for use in checksum computation. */
| 101 | |
| 102 | /** Expand a HRP for use in checksum computation. */ |
| 103 | data 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. */ |
| 118 | bool VerifyChecksum(const std::string& hrp, const data& values) |
no test coverage detected