Skip to content

Instantly share code, notes, and snippets.

View afifmakarim's full-sized avatar

Afif Makarim afifmakarim

View GitHub Profile
@afifmakarim
afifmakarim / aes-128-ecb.js
Created July 25, 2021 04:42
aes-128-ecb php and javascript with same result
const cryptojs = require('crypto-js')
const bin2hex = (s) => {
var v, i, f = 0, a = [];
s += '';
f = s.length;
for (i = 0; i < f; i++) {
a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/, "0$1");
}
@afifmakarim
afifmakarim / custom-aes-256-gcm-sample.js
Last active July 21, 2021 12:59
AES-256-GCM - Custom AES256GCM with prefix & md5 secretKey
const crypto = require('crypto');
const encrypt = (text, secret, prefix) => {
// make buffer length 12
const iv = Buffer.alloc(12);
const key = crypto.createHash('md5').update(secret).digest("hex");
// AES 256 GCM Mode
@afifmakarim
afifmakarim / eslint_prettier_airbnb.md
Created June 22, 2021 14:09 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node