How to use the js-sha256.create function in js-sha256

To help you get started, we’ve selected a few js-sha256 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CodeChain-io / codechain-web-wallet / src / utils / ImageLoader / ImageLoader.tsx View on Github external
private getDefaultImage = () => {
        const hash = sha256.create();
        hash.update(this.props.data);
        const identiconData = new Identicon(
            hash.hex(),
            this.props.size
        ).toString();
        return `data:image/png;base64,${identiconData}`;
    };
github guggero / bip-schnorr / src / convert.js View on Github external
function hash(buffer) {
  return Buffer.from(sha256.create().update(buffer).array());
}
github SuperNETorg / Agama / routes / shepherd / electrum / keys.js View on Github external
shepherd.seedToWif = (seed, network, iguana) => {
    let bytes;

    if (process.argv.indexOf('spvold=true') > -1) {
      bytes = buggySha256(seed, { asBytes: true });
    } else {
      const hash = sha256.create().update(seed);
      bytes = hash.array();
    }

    if (iguana) {
      bytes[0] &= 248;
      bytes[31] &= 127;
      bytes[31] |= 64;
    }

    const d = bigi.fromBuffer(bytes);
    const keyPair = shepherd.isZcash(network) ? new bitcoinZcash.ECPair(d, null, { network: shepherd.getNetworkData(network) }) : new bitcoin.ECPair(d, null, { network: shepherd.getNetworkData(network) });
    const keys = {
      pub: keyPair.getAddress(),
      priv: keyPair.toWIF(),
    };
github orachide / heketi-ui / server / services / heketi.service.js View on Github external
var generateJwtToken = function(httpConfig){
    var user = heketiUser;
    var secret = heketiSecret;
    var hash = sha256.create();
    hash.update(httpConfig.method.toUpperCase()+'&'+httpConfig.url);
    var now = moment();

    var qsh = hash.hex();
    var payload = {
        iss: user,
        iat: now.unix(),
        exp: now.add(7, 'days').unix(),
        qsh: qsh
      }
    var token = jwtSimple.encode(payload, secret);
    return token;
}
github jones2000 / HQChart / vue.demo / bitdemo / src / pages / stockHq / components / stockHq.vue View on Github external
RequestHistoryData(data, callback)  //第3方日线历史数据请求
        {
            data.PreventDefault = true;
            var period=data.Self.Period;    //获取周期
            var symbol=this.Symbol;
            var name=this.Name;
            var peirodMenu=this.GetPeriodInfo(period)
            var type=peirodMenu.Type, min=peirodMenu.Min, count=500;

            var startDateTime = moment().format('YYYYMMDDHHmmss');
            var hash = sha256.create();
            hash.update(API_KEY + this.PairName + type + min + startDateTime + count + SECRET_KEY);
            var secretHash = hash.hex();

            $.ajax({
                url: 'https://bit.zealink.com/api/selectchart',
                type: 'post',
                data: 
                {
                    pairname: this.PairName,
                    apikey: API_KEY,
                    type: type,
                    min: min,
                    startdatetime: startDateTime,
                    count: count,
                    secrethash: secretHash
                },
github CodeChain-io / codechain-explorer / src / components / util / ImageLoader / ImageLoader.tsx View on Github external
private getDefaultImage = () => {
        const hash = sha256.create();
        hash.update(this.props.data);
        const identiconData = new Identicon(hash.hex(), this.props.size).toString();
        return `data:image/png;base64,${identiconData}`;
    };