How to use the crypto-js/sha256 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 segmentstream / digital-data-manager / src / integrations / DDManagerStreaming.js View on Github external
trackEvent (event) {
    // identify
    if (size(event.user)) {
      const user = event.user || {}
      if (user.email) {
        this.setEmailHash(sha256(user.email.trim()).toString())
      }
      if (user.anonymousId) {
        this.setAnonymousId(user.anonymousId)
      }
      if (user.userId) {
        this.setUserId(String(user.userId))
      }
    }

    if (event.name === VIEWED_PAGE && event.website) {
      this.website = this.filters.filterWebsite(event.website)
    }
    // for SPA apps we create campaign only on first pageview
    if (event.name === VIEWED_PAGE) this.viewedPageCounter += 1

    this.sendEventHit(event)
github AnomalyInnovations / serverless-stack-demo-client / src / libs / sigV4Client.js View on Github external
function hash(value) {
    return SHA256(value); // eslint-disable-line
  }
github kndt84 / aws-api-gateway-client / src / lib / apiGatewayCore / sigV4Client.js View on Github external
function hash(value) {
    return SHA256(value); // eslint-disable-line
  }
github jimmyn / angular-aws-apig / src / aws-signature-v4.js View on Github external
function hash(value) {
  return SHA256(value);
}
github CityOfZion / neon-js / packages / neon-core / src / utils.js View on Github external
export const hash256 = (hex) => {
  if (typeof hex !== 'string') throw new Error('reverseHex expects a string')
  if (hex.length % 2 !== 0) throw new Error(`Incorrect Length: ${hex}`)
  let hexEncoded = hexEncoding.parse(hex)
  let ProgramSha256 = SHA256(hexEncoded)
  return SHA256(ProgramSha256).toString()
}
github PacktPublishing / Foundations-of-Blockchain / Chapter07 / NEO / proof_of_ownership_app / interface / src / App.js View on Github external
function hash256(hex) {
    if (typeof hex !== 'string') throw new Error('reverseHex expects a string');
    if (hex.
            length % 2 !== 0) throw new Error('Incorrect Length:');
    var hexEncoded = hexEncoding.parse(hex);
    var ProgramSha256 = SHA256(hexEncoded);
    return SHA256(ProgramSha256).toString()
}
github forbole / big_dipper / imports / ui / ledger / ledger.js View on Github external
function createCosmosAddress(publicKey) {
    const message = CryptoJS.enc.Hex.parse(publicKey.toString(`hex`))
    const hash = ripemd160(sha256(message)).toString()
    const address = Buffer.from(hash, `hex`)
    const cosmosAddress = bech32ify(address, Meteor.settings.public.bech32PrefixAccAddr)
    return cosmosAddress
}
github CityOfZion / neon-js / packages / neon-core / src / wallet / nep2.ts View on Github external
const derived = Buffer.from(key).toString("hex");
          const derived1 = derived.slice(0, 64);
          const derived2 = derived.slice(64);
          const ciphertext = {
            ciphertext: enc.Hex.parse(encrypted),
            salt: "",
            iv: ""
          };
          const decrypted = AES.decrypt(
            ciphertext,
            enc.Hex.parse(derived2),
            AES_OPTIONS
          );
          const privateKey = hexXor(decrypted.toString(), derived1);
          const account = new Account(privateKey);
          const newAddressHash = SHA256(SHA256(
            enc.Latin1.parse(account.address)
          ) as any)
            .toString()
            .slice(0, 8);
          if (addressHash !== newAddressHash) {
            reject(new Error("Wrong password or scrypt parameters!"));
          }
          log.info(`Successfully decrypted ${encryptedKey}`);
          resolve(account.WIF);
        }
      }
    );
github CityOfZion / neon-js / packages / neon-core / src / utils.js View on Github external
export const hash160 = (hex) => {
  if (typeof hex !== 'string') throw new Error('reverseHex expects a string')
  if (hex.length % 2 !== 0) throw new Error(`Incorrect Length: ${hex}`)
  let hexEncoded = hexEncoding.parse(hex)
  let ProgramSha256 = SHA256(hexEncoded)
  return RIPEMD160(ProgramSha256).toString()
}