MCPcopy Create free account
hub / github.com/ElementsProject/lightning / calculate_checksum

Function calculate_checksum

common/codex32.c:178–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178static 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. */
192static bool pull_chars(char *dst, size_t len, const char **cursor, size_t *max)

Callers 1

codex32_secret_encodeFunction · 0.85

Calls 3

input_hrpFunction · 0.85
input_data_strFunction · 0.85
input_own_targetFunction · 0.85

Tested by

no test coverage detected