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

Function hash_from_base

common/bolt12_id.c:7–18  ·  view source on GitHub ↗

Given a base secret, an easy one-way function is SHA(base || input) */

Source from the content-addressed store, hash-verified

5
6/* Given a base secret, an easy one-way function is SHA(base || input) */
7static void hash_from_base(const struct secret *base_secret,
8 const void *input,
9 size_t input_len,
10 struct sha256 *hash)
11{
12 struct sha256_ctx shactx;
13
14 sha256_init(&shactx);
15 sha256_update(&shactx, base_secret, sizeof(*base_secret));
16 sha256_update(&shactx, input, input_len);
17 sha256_done(&shactx, hash);
18}
19
20void bolt12_path_secret(const struct secret *base_secret,
21 const struct sha256 *payment_hash,

Callers 2

bolt12_path_secretFunction · 0.85
bolt12_alias_tweakFunction · 0.85

Calls 3

sha256_initFunction · 0.85
sha256_updateFunction · 0.85
sha256_doneFunction · 0.85

Tested by

no test coverage detected