| 176 | } |
| 177 | |
| 178 | static void calculate_checksum(const char *hrp, char *csum, const char *codex_datastr, |
| 179 | const struct checksum_engine *initial_engine) |
| 180 | { |
| 181 | struct checksum_engine engine = *initial_engine; |
| 182 | |
| 183 | input_hrp(engine.generator, engine.residue, hrp, engine.len); |
| 184 | input_data_str(engine.generator, engine.residue, codex_datastr, engine.len); |
| 185 | input_own_target(engine.generator, engine.residue, engine.target, engine.len); |
| 186 | |
| 187 | for (size_t i = 0; i < engine.len; i++) |
| 188 | csum[i] = bech32_charset[engine.residue[i]]; |
| 189 | } |
| 190 | |
| 191 | /* Pull len chars from cursor into dst. */ |
| 192 | static bool pull_chars(char *dst, size_t len, const char **cursor, size_t *max) |
no test coverage detected