Last active
September 9, 2022 11:13
-
-
Save visitdigital/75d8cbf2d508f10ee4b9831d8cd59b39 to your computer and use it in GitHub Desktop.
Encrypt data with Zapier using Zapier Code App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto") | |
function encrypt(key, data) { | |
var cipher = crypto.createCipher('aes-256-cbc', key); | |
var crypted = cipher.update(data, 'utf-8', 'hex'); | |
crypted += cipher.final('hex'); | |
return crypted; | |
} | |
var key = "supersecretkey"; | |
var data = "SOMETHING YOU WANT TO ENCRYPT"; | |
var encryptedText = encrypt(key, data); | |
output = {encrypted: encryptedText}; |
Hi, why this one dont need "-iv" parameter ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have to use Sha1 encrypt mode. I can use this code for that?