Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
})
})
makeEncryptor(state => AES.encrypt(state, secretKey).toString())
_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());
}
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)
});
};
crypto.encrypt = function(value){
return AES.encrypt(value, passphrase, { format: JsonFormatter }).toString();
};
export function encrypt(value, password) {
var encrypted = AES.encrypt(value, password);
return encrypted.toString();
}
export function decrypt(cipherText, password) {
this.encryptMessage = function(message, encryptionKey, iv){
var encrypted = AES.encrypt(message, encryptionKey, {iv: iv});
return encrypted.ciphertext;
}
crypto.encrypt = function(value){
return AES.encrypt(value, passphrase, { format: JsonFormatter }).toString();
};