How to use the crypto-js/enc-hex.parse 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 peerplays-network / peerplays-core-gui / lib / ecc / src / aes.js View on Github external
decryptHexToBuffer(cipher) {
        assert(cipher, "Missing cipher text");
        // Convert data into word arrays (used by Crypto)
        var cipher_array = encHex.parse(cipher);
        var plainwords = this._decrypt_word_array(cipher_array);
        var plainhex = encHex.stringify(plainwords);
        return new Buffer(plainhex, 'hex');
    }
github bitshares / bitsharesjs / lib / ecc / src / aes.js View on Github external
decryptHexToBuffer(cipher) {
        assert(cipher, "Missing cipher text");
        // Convert data into word arrays (used by Crypto)
        var cipher_array = encHex.parse(cipher);
        var plainwords = this._decrypt_word_array(cipher_array);
        var plainhex = encHex.stringify(plainwords);
        return new Buffer(plainhex, "hex");
    }
github CityOfZion / neon-js / packages / neon-core / src / u / hash.ts View on Github external
function hash(
  hex: string,
  hashingFunction: (i: any) => CryptoJS.WordArray
): string {
  const hexEncoded = hexEncoding.parse(hex);
  const result = hashingFunction(hexEncoded);
  return result.toString(hexEncoding);
}
github peerplays-network / peerplays-core-gui / lib / ecc / src / aes.js View on Github external
encryptHex(plainhex) {
        var plain_array = encHex.parse(plainhex);
        var cipher_array = this._encrypt_word_array(plain_array);
        return encHex.stringify(cipher_array);
    }
}
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()
}
github bitshares / bitsharesjs / lib / ecc / src / aes.js View on Github external
static fromSha512(hash) {
        assert.equal(
            hash.length,
            128,
            `A Sha512 in HEX should be 128 characters long, instead got ${
                hash.length
            }`
        );
        var iv = encHex.parse(hash.substring(64, 96));
        var key = encHex.parse(hash.substring(0, 64));
        return new Aes(iv, key);
    }