(cipher_alg, key, iv, text)
| 484 | |
| 485 | // to encrypt data |
| 486 | function encryptText(cipher_alg, key, iv, text) { |
| 487 | const cipher = crypto.createCipheriv(cipher_alg, key.toString('hex').slice(0, 32), iv.toString('hex').slice(0, 16)); |
| 488 | let result = cipher.update(text, 'utf8', 'hex'); |
| 489 | result += cipher.final('hex'); |
| 490 | return result; |
| 491 | } |
| 492 | |
| 493 | // to decrypt data |
| 494 | // eslint-disable-next-line |
no outgoing calls
no test coverage detected