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