Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const iv = crypto.randomBytes(BLOCK_SIZE)
const cipher = crypto.createCipheriv(ALGORITHM, key, iv)
let cipherText
try {
cipherText = cipher.update(text, 'utf8', 'hex')
cipherText +='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