Skip to content

Instantly share code, notes, and snippets.

@visitdigital
Last active September 9, 2022 11:13
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save visitdigital/75d8cbf2d508f10ee4b9831d8cd59b39 to your computer and use it in GitHub Desktop.
Save visitdigital/75d8cbf2d508f10ee4b9831d8cd59b39 to your computer and use it in GitHub Desktop.
Encrypt data with Zapier using Zapier Code App
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};
@pedroibn
Copy link

I have to use Sha1 encrypt mode. I can use this code for that?

@mestartlearncode
Copy link

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