How to use the crypto-js.SHA3 function in crypto-js

To help you get started, we’ve selected a few crypto-js 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 QuantumMechanics / NEM-sdk / src / model / apostille.js View on Github external
let checksum;
    // Append byte to checksum
    if (isPrivate) {
        checksum = "4e5459" + hashing.signedVersion;
    } else {
        checksum = "4e5459" + hashing.version;
    }
    // Build the apostille hash
    if (hashing.name === "MD5") {
        return checksum + CryptoJS.MD5(data);
    } else if (hashing.name === "SHA1") {
        return checksum + CryptoJS.SHA1(data);
    } else if (hashing.name === "SHA256") {
        return checksum + CryptoJS.SHA256(data);
    } else if (hashing.name === "SHA3-256") {
        return checksum + CryptoJS.SHA3(data, {
            outputLength: 256
        });
    } else {
        return checksum + CryptoJS.SHA3(data, {
            outputLength: 512
        });
    }
};
github QuantumMechanics / NEM-sdk / src / crypto / cryptoHelpers.js View on Github external
function key_derive(shared, salt, sk, pk) {
    nacl.lowlevel.crypto_shared_key_hash(shared, pk, sk, hashfunc);
    for (let i = 0; i < salt.length; i++) {
        shared[i] ^= salt[i];
    }
    let hash = CryptoJS.SHA3(convert.ua2words(shared, 32), {
        outputLength: 256
    });
    return hash;
}
github tsuzukit / meta-transaction / lib / transaction.js View on Github external
static encodeFunctionTxData(functionName, types, args) {
    let fullName = functionName + '(' + types.join() + ')';
    let signature = CryptoJS.SHA3(fullName, { outputLength: 256 }).toString(CryptoJS.enc.Hex).slice(0, 8);
    return signature + util.stripHexPrefix(web3.eth.abi.encodeParameters(types, args));
  };
github davidgljay / nametag / server / src / graph / models / Users.js View on Github external
const hashPassword = (password) => {
  let hashedPassword = SHA3(password, {outputLength: 224})
  return hashedPassword.toString(enc.Base64)
}
github 3box / muport-core-js / src / ethereum-utils.js View on Github external
const encodeMethodCall = (methodName, args) => {
  const methodAbi = RevokeAndPublishAbi.filter(obj => obj.name === methodName)[0]
  const types = methodAbi.inputs.map(o => o.type)
  const fullName = methodName + '(' + types.join() + ')'
  const signature = CryptoJS.SHA3(fullName, { outputLength: 256 }).toString(CryptoJS.enc.Hex).slice(0, 8)

  return '0x' + signature + coder.encodeParams(types, args)
}
github QuantumMechanics / NEM-sdk / src / crypto / cryptoHelpers.js View on Github external
function hashfunc(dest, data, dataLength) {
    let convertedData = convert.ua2words(data, dataLength);
    let hash = CryptoJS.SHA3(convertedData, {
        outputLength: 512
    });
    convert.words2ua(dest, hash);
}