How to use the js-sha3.sha3_512 function in js-sha3

To help you get started, we’ve selected a few js-sha3 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 luxtagofficial / Apostille-library / src / hash / sha3-512.ts View on Github external
public signedHashing(data: string, signerPrivateKey: string, networkType: NetworkType) {
    const dataHash = sha3_512(data);

    if (networkType === NetworkType.MAIN_NET || networkType === NetworkType.TEST_NET) {
      throw Errors[Errors.NETWORK_TYPE_NOT_SUPPORTED];
    } else {
      const signer = Account.createFromPrivateKey(signerPrivateKey, networkType);
      return this.checksum +  signer.signData(dataHash);
    }
  }
}
github ontio / ontology-ts-sdk / src / crypto / Key.ts View on Github external
return cryptoJS.SHA224(cryptoJS.enc.Hex.parse(msg)).toString();
        case SignatureScheme.ECDSAwithSHA256:
            return cryptoJS.SHA256(cryptoJS.enc.Hex.parse(msg)).toString();
        case SignatureScheme.ECDSAwithSHA384:
            return cryptoJS.SHA384(cryptoJS.enc.Hex.parse(msg)).toString();
        case SignatureScheme.ECDSAwithSHA512:
        case SignatureScheme.EDDSAwithSHA512:
            return cryptoJS.SHA512(cryptoJS.enc.Hex.parse(msg)).toString();
        case SignatureScheme.ECDSAwithSHA3_224:
            return sha3_224(hexstring2ab(msg));
        case SignatureScheme.ECDSAwithSHA3_256:
            return sha3_256(hexstring2ab(msg));
        case SignatureScheme.ECDSAwithSHA3_384:
            return sha3_384(hexstring2ab(msg));
        case SignatureScheme.ECDSAwithSHA3_512:
            return sha3_512(hexstring2ab(msg));
        case SignatureScheme.ECDSAwithRIPEMD160:
            return cryptoJS.RIPEMD160(cryptoJS.enc.Hex.parse(msg)).toString();
        case SignatureScheme.SM2withSM3:
            return (new sm3()).sum(hexstring2ab(msg), 'hex');
        default:
            throw new Error('Unsupported hash algorithm.');
        }
    }