Skip to content

Instantly share code, notes, and snippets.

View lomelisan's full-sized avatar

Carlos Lomeli Sandia lomelisan

  • Little Emperors
  • Valencia. Venezuela
View GitHub Profile
@Tiriel
Tiriel / encryption.js
Last active January 24, 2024 08:15
Symetric encryption/decryption for PHP and NodeJS communication
'use strict';
const crypto = require('crypto');
const AES_METHOD = 'aes-256-cbc';
const IV_LENGTH = 16; // For AES, this is always 16, checked with php
const password = 'lbwyBzfgzUIvXZFShJuikaWvLJhIVq36'; // Must be 256 bytes (32 characters)
function encrypt(text, password) {