Skip to content

Instantly share code, notes, and snippets.

View metalsadman's full-sized avatar

Aldrin Marquez metalsadman

View GitHub Profile
@metalsadman
metalsadman / encryption.js
Created June 4, 2019 04:40 — forked from Tiriel/encryption.js
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) {
@metalsadman
metalsadman / Cryptor.php
Created June 4, 2019 03:23 — forked from Radiergummi/Cryptor.php
A PHP class to encrypt and decrypt strings using a static application secret. Input is converted to hex strings to enable easier handling
<?php
namespace Vendor\Library;
use function bin2hex;
use function hex2bin;
use function openssl_decrypt;
use function openssl_encrypt;
/**