How to use sha - 10 common examples

To help you get started, we’ve selected a few sha 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 chainside / btcnodejs / lib / crypto.js View on Github external
hash() {
        const to_hash = this.type === "uncompressed" ? this.uncompressed : this.compressed;
        const sha256 = shajs("sha256")
            .update(to_hash.toHex(), "hex")
            .digest("hex");
        const ripe = new ripemd160().update(sha256, "hex").digest("hex");
        return new ByteBuffer.fromHex(ripe);
    }
github chainside / btcnodejs / lib / scripts.js View on Github external
p2wshHash() {
        const sha256 = shajs("sha256")
            .update(this.body.toHex(0, this.body.capacity()), "hex")
            .digest("hex");
        return new ByteBuffer.fromHex(sha256);
    }
github chainside / btcnodejs / lib / transaction.js View on Github external
hash() {
        const serialized = this.serialize();
        const hex = serialized.toHex(0, serialized.capacity());
        return $.swapHex(
            shajs("sha256")
                .update(
                    shajs("sha256")
                        .update(hex, "hex")
                        .digest("hex"),
                    "hex"
                )
                .digest("hex")
        );
    }
github chainside / btcnodejs / lib / bip39.js View on Github external
function calculateChecksumBits(entropy) {
    var sha_256 = shajs("sha256").update(entropy, "hex").digest("hex");
    var entropy_sha256 = $.hexToBinary(sha_256);
    return entropy_sha256.substring(0, entropy.length * 4 / 32);
}
github spderosso / deja-vu / catalog / access / passkeyAuthentication / src / app.ts View on Github external
create: Helpers.resolve_create(mean.db, "passkey", "passkeys", passkey => {
            passkey["code"] = shajs('sha256').update(passkey.code).digest('hex');
            return passkey;
        }),
        update: Helpers.resolve_update(mean.db, "passkey")
github microsoft / BotFramework-Emulator / packages / app / shared / src / oauthLinkEncoder.ts View on Github external
public static generateCodeVerifier(): string {
        this.CodeVerifier = uniqueId(32);

        let codeChallenge = shajs('sha256').update(this.CodeVerifier).digest('hex');

        return codeChallenge;
    }
github YMFE / yapi / common / power-string.js View on Github external
sha256: function(str) {
    return sha('sha256')
      .update(str)
      .digest('hex');
  },
github chainside / btcnodejs / lib / block.js View on Github external
blockHash() {
        const serialized = this.serialize();
        const hex = serialized.toHex(0, serialized.capacity());
        return $.swapHex(
            shajs("sha256")
                .update(
                    shajs("sha256")
                        .update(hex, "hex")
                        .digest("hex"),
                    "hex"
                )
                .digest("hex")
        );
    }
}
github crypto-browserify / createHash / browser.js View on Github external
module.exports = function createHash (alg) {
  alg = alg.toLowerCase()
  if (alg === 'md5') return new MD5()
  if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()

  return new Hash(sha(alg))
}
github sx1989827 / DOClever / node_modules / create-hash / browser.js View on Github external
module.exports = function createHash (alg) {
  alg = alg.toLowerCase()
  if (alg === 'md5') return new MD5()
  if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()

  return new Hash(sha(alg))
}

sha

Check and get file hashes

(BSD-2-Clause OR MIT)
Latest version published 6 years ago

Package Health Score

58 / 100
Full package analysis

Popular sha functions