feat: add verify_preimage utility function (#3153)
This commit is contained in:
parent
bd19d78834
commit
7b29223e95
1 changed files with 6 additions and 0 deletions
|
|
@ -23,6 +23,12 @@ def fake_privkey(secret: str) -> str:
|
||||||
).hex()
|
).hex()
|
||||||
|
|
||||||
|
|
||||||
|
def verify_preimage(preimage: str, payment_hash: str) -> bool:
|
||||||
|
preimage_bytes = bytes.fromhex(preimage)
|
||||||
|
calculated_hash = sha256(preimage_bytes).hexdigest()
|
||||||
|
return calculated_hash == payment_hash
|
||||||
|
|
||||||
|
|
||||||
class AESCipher:
|
class AESCipher:
|
||||||
"""This class is compatible with crypto-js/aes.js
|
"""This class is compatible with crypto-js/aes.js
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue