A question about aes128 encryption for novice node

how do you write the following code in node?

const hash = crypto.createHash( "MD5" )
hash.update( aesKey )
const aesKeySignStr = hash.digest()
const iv = Math.random().toString( 36 ).substr( 2 )

const cipher = crypto.createCipher( "aes-128-cbc", aesKeySignStr, iv )
console.log( JSON.stringify( this.params ) );
let crypted = cipher.update( JSON.stringify( this.params ), "utf8", "hex" )
crypted += cipher.final( "hex" )

Please help me.

Mar.10,2021

results are different. Then print out the values in each process and have a look. There are only two reasons for the difference. 1. The algorithm is different, 2. The initial value is different


node doesn't quite understand, but I guess it's like this
because both the initial vector and the secret key have to be consistent with the size of the chunk, that is to say, if you use cbc-128, the size of both is 16 bytes
, but your code is obviously not like this

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bebeec-3130c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bebeec-3130c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?