Skip to content

Instantly share code, notes, and snippets.

View dilutedev's full-sized avatar
🖥️
Backend Engineer

Isaac Sunday dilutedev

🖥️
Backend Engineer
View GitHub Profile
@Vermeille
Vermeille / encrypt.js
Last active January 29, 2025 13:20
facebook messenger encryption
// configure with jQuery 3
async function aesGcmEncrypt(plaintext, password) {
const pwUtf8 = new TextEncoder().encode(password); // encode password as UTF-8
const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8); // hash the password
const iv = crypto.getRandomValues(new Uint8Array(12)); // get 96-bit random iv
const alg = { name: 'AES-GCM', iv: iv }; // specify algorithm to use