Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
feed.encrypt3
const iv = crypto.randomBytes(BLOCK_SIZE)
const cipher = crypto.createCipheriv(ALGORITHM, key, iv)
let cipherText
try {
cipherText = cipher.update(text, 'utf8', 'hex')
cipherText += cipher.final('hex')
cipherText = iv.toString('hex') + cipherText
} catch (e) {
cipherText = null
}
return cipherText
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment