const crypto = require("crypto")
const iv = crypto.randomBytes(16)
const secret = crypto.randomBytes(32)
const data = "hahahah"
const cipher = crypto.createCipheriv("AES-256-CBC",secret,iv)
cipher.update(data)
const buffer = cipher.final()
const cipher2 = crypto.createCipheriv("AES-256-CBC",secret,iv)
let hex = cipher2.update(data,"utf-8","hex")
hex += cipher2.final("hex")
console.log(buffer,buffer.toString("hex"),hex)
const decipher = crypto.createDecipheriv("AES-256-CBC",secret,iv)
decipher.update(hex,"utf8")
const decodeBuffer = decipher.final()
console.log(decodeBuffer)