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

Function hkdf_sha256

tests/test_opening.py:42–50  ·  view source on GitHub ↗

RFC5869 HKDF-SHA256, matching ccan's hkdf_sha256 (salt is the HMAC key).

(ikm, salt, info, length)

Source from the content-addressed store, hash-verified

40
41
42def hkdf_sha256(ikm, salt, info, length):
43 """RFC5869 HKDF-SHA256, matching ccan's hkdf_sha256 (salt is the HMAC key)."""
44 prk = hmac.new(salt if salt is not None else b'', ikm, hashlib.sha256).digest()
45 okm, t, i = b'', b'', 1
46 while len(okm) < length:
47 t = hmac.new(prk, t + info + bytes([i]), hashlib.sha256).digest()
48 okm += t
49 i += 1
50 return okm[:length]
51
52
53def channel_delayed_basepoint_secret(hsm_secret, peer_id, dbid):

Callers 15

get_channel_seedFunction · 0.50
dumponchaindescriptorsFunction · 0.50
make_runeFunction · 0.50
print_node_idFunction · 0.50
node_keyFunction · 0.50
hsm_channel_secret_baseFunction · 0.50
handle_derive_secretFunction · 0.50
get_channel_seedFunction · 0.50
handle_sign_bolt12_2Function · 0.50
hsmd_initFunction · 0.50
json_exposesecretFunction · 0.50

Calls 2

digestMethod · 0.80
newMethod · 0.45

Tested by

no test coverage detected