If a php openssl_encrypt is converted to node, it will not succeed?

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
Menu