Converting a Lightning Network preimage to its hash
source link: https://gist.github.com/vindard/12e4af7819a3e38aef07cea4a511c4e1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Converting a Lightning Network preimage to its hash · GitHub
Instantly share code, notes, and snippets.
import { createHash } from "crypto"
const hashFromPreImage = (preImage) => { const preImageBuf = Buffer.from(preImage, "hex") const sha256 = (buffer: Buffer) => createHash("sha256").update(buffer).digest("hex")
return sha256(preImageBuf) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK