Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const BCHJS = require('@chris.troutner/bch-js')
- const bchjs = new BCHJS()
- async function runTest() {
- try {
- const numNum = 123; // 7B in hex
- console.log(`numNum: `, numNum);
- const numHex = numNum.toString(16);
- console.log(`numHex: ${numHex}`);
- const numBuf = Buffer.from(numHex, "hex");
- console.log(`numBuf: `, numBuf);
- const hash = bchjs.Crypto.sha256(numBuf)
- console.log(`hash: `, hash)
- const hashStr = hash.toString("hex")
- console.log(`hashStr: ${hashStr}`)
- } catch(err) {
- console.error(err)
- }
- }
- runTest()
Advertisement
Add Comment
Please, Sign In to add comment