How to use the crypto-js/aes.encrypt 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 CityOfZion / neon-js / packages / neon-core / src / wallet / nep2.js View on Github external
asyncScrypt(Buffer.from(keyphrase.normalize('NFC'), 'utf8'), Buffer.from(addressHash, 'hex'), n, r, p, 64, (error, progress, key) => {
      if (error != null) {
        reject(error)
      } else if (key) {
        const derived = Buffer.from(key).toString('hex')
        const derived1 = derived.slice(0, 64)
        const derived2 = derived.slice(64)
        // AES Encrypt
        const xor = hexXor(account.privateKey, derived1)
        const encrypted = AES.encrypt(enc.Hex.parse(xor), enc.Hex.parse(derived2), AES_OPTIONS)
        const assembled = NEP_HEADER + NEP_FLAG + addressHash + encrypted.ciphertext.toString()
        const encryptedKey = bs58check.encode(Buffer.from(assembled, 'hex'))
        log.info(`Successfully encrypted key to ${encryptedKey}`)
        resolve(encryptedKey)
      }
    })
  })
github maxdeviant / redux-persist-transform-encrypt / src / sync.js View on Github external
  makeEncryptor(state => AES.encrypt(state, secretKey).toString())
github peerplays-network / peerplays-core-gui / lib / ecc / src / aes.js View on Github external
_encrypt_word_array(plaintext) {
        //https://code.google.com/p/crypto-js/issues/detail?id=85
        var cipher = AES.encrypt(plaintext, this.key, {iv: this.iv});
        return encBase64.parse(cipher.toString());
    }
github bipbop / harlan / src / js / internals / modules / iugu.js View on Github external
const saveToken = password => {
            localStorage[iuguKey()] = JSON.stringify({
                token: AES.encrypt(CryptoJS.lib.WordArray.random(256).toString() +
                        JSON.stringify(creditCard), password).toString(),
                cardLabel,
                password: TwinBcrypt.hashSync(password)
            });
        };
github grasshopper-cms / grasshopper-api-js / lib / utils / crypto.js View on Github external
crypto.encrypt = function(value){
        return AES.encrypt(value, passphrase, { format: JsonFormatter }).toString();
    };
github pubkey / rxdb / dist / es / plugins / encryption.js View on Github external
export function encrypt(value, password) {
  var encrypted = AES.encrypt(value, password);
  return encrypted.toString();
}
export function decrypt(cipherText, password) {
github csquared / fernet.js / fernet.js View on Github external
this.encryptMessage = function(message, encryptionKey, iv){
    var encrypted = AES.encrypt(message, encryptionKey, {iv: iv});
    return encrypted.ciphertext;
  }
github grasshopper-cms / grasshopper-core-nodejs / lib / utils / crypto.js View on Github external
crypto.encrypt = function(value){
        return AES.encrypt(value, passphrase, { format: JsonFormatter }).toString();
    };