Expand a HRP for use in checksum computation. */
| 126 | |
| 127 | /** Expand a HRP for use in checksum computation. */ |
| 128 | data 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. */ |
| 143 | Encoding VerifyChecksum(const std::string& hrp, const data& values) |
no test coverage detected