How to decrypt 16-character iv and 32-character key with aes-128-cbc in nodejs?

  node.js, question

It is always wrong to use the method provided online: Invalid key length
Is there any way?

const hash = '56e71d68a230081a0fe562ae4daaf58451db4ce4bde4f881b65b713cc8c3248405a3a2c8520cb8a7215f9ebaa604dae62d320f2c77bda679a2d3df1ecc790ee5a7113afe6  974e5e89d2a10d0e63a2b5cbe05923fe6765f0eca1ddea969e4fe39b1d951554b0dfe66aafd4b24bd138d848c479186ed13139328b37e34200ecd4a718b7f3f268fdc6d1a174a192c8d1150  a8c56686783f19dbeaa7f03a943ce4089768655843311e5c3ac8ae05d0d5990723521e04dcb5137e470c20990365f742ae78492178cb2d512cb7cb55d229218dc66f1f5234e3546cca534d3e8787dfb6b720c069dbb9a344d944d22aaf01e921'
 const iv = 'e6db271db12d4d47'
 const key = '9cd5b4cf899492077b4a125a79af8e76'
 const crypto = require('crypto')
 
 const aesDecrypt = function(data, secretKey, iv) {
 const cipherEncoding = 'base64'
 const clearEncoding = 'utf8'
 const cipher = crypto.createDecipheriv('aes-128-cbc',secretKey, iv)
 Return cipher. update (data, cipher encoding, clearencoding) plus cipher.final(clearEncoding)
 bracket
 
 console.log(aesDecrypt(hash, key, iv))

1. The length of key is not correct. Since it is 128-bit aes encryption algorithm and cbc encryption mode is adopted, it is good that the length of KEY is 16.
2. Since you specify the encoding format of your ciphertextbase64But your hash code is notbase64Yes. The decryption will still fail.
3. Revise your example and run the following code to get plaintext output.

// base64 encode cipher
 Const hash = 'riX6dKnCg8vOt plus Z3LxnM/oZThZEjOSUQJR9v plus DSDY3E='
 const iv = 'e6db271db12d4d47'
 // length of key is 16 of 128 bit
 const key = '9cd5b4cf89949207'
 const crypto = require('crypto')
 const aesDecrypt = function(data, secretKey, iv) {
 const cipherEncoding = 'base64'
 const clearEncoding = 'utf8'
 const cipher = crypto.createDecipheriv('aes-128-cbc',secretKey, iv)
 Return cipher. update (data, cipher encoding, clearencoding) plus cipher.final(clearEncoding)
 bracket
 
 console.log(aesDecrypt(hash, key, iv)) // base64-encoded-encrypted-data