Skip to content

Instantly share code, notes, and snippets.

View fnasciment0's full-sized avatar

Fábio Nascimento fnasciment0

View GitHub Profile
@fnasciment0
fnasciment0 / encryption.js
Created November 7, 2024 18:25
Script for AES-256-CBC encryption and decryption.
const crypto = require('crypto');
const secretKey = [secret_key]
// Generate a 32-byte encryption key using SHA-256 hash of the provided key
const key = crypto
.createHash('sha256')
.update(secretKey)
.digest(); // 32 bytes required for AES-256
const encryptionMethod = 'aes-256-cbc' // AES encryption with 256-bit key and CBC mode
@fnasciment0
fnasciment0 / avatar.js
Last active November 23, 2023 12:55
Apply a random color based on text in each ui-avatar found with JQuery
window.onload = function() {
loadUiAvatar();
};
function loadUiAvatar() {
if($('img.gf-avatar').length > 0) {
$('img.gf-avatar').each(function() {
const srcAttr = $(this).attr('src');
if(typeof srcAttr === 'undefined') {