Skip to content

Instantly share code, notes, and snippets.

View zhfnjust's full-sized avatar
💭
bitcoin sv is everything

hh zhfnjust

💭
bitcoin sv is everything
View GitHub Profile
@zhfnjust
zhfnjust / txAdvancedArgs.js
Created November 16, 2021 16:01 — forked from scrypt-sv/txAdvancedArgs.js
A simple program to compute arguments for contract TxAdvanced
/*
* a simple program to compute arguments for contract TxAdvanced
*/
const bsv = require('bsv')
const BN = bsv.crypto.BN
const pt = bsv.crypto.Point
const G = pt.getG()
const N = pt.getN()
@zhfnjust
zhfnjust / nodeJs.crypto.calculatingHash.js
Created December 7, 2018 12:46 — forked from GuillermoPena/nodeJs.crypto.calculatingHash.js
NodeJS - CRYPTO : How to calculate a hash from file or string
var crypto = require('crypto')
, fs = require('fs')
// Algorithm depends on availability of OpenSSL on platform
// Another algorithms: 'sha1', 'md5', 'sha256', 'sha512' ...
var algorithm = 'sha1'
, shasum = crypto.createHash(algorithm)
// Updating shasum with file content
var filename = __dirname + "/anything.txt"