Getting Started
Accordion
NewBarricade Tape
NewButtons
NewContact Section
NewFile Stack
NewGooey Words
NewGlowing Dots Background
NewImage Pile
NewJelly Loader
NewMask Cursor Effect
NewMagnet Tabs
NewMasonry Grid
NewPrismatic Haze Background
NewProjects Section
NewProximity Background
NewProximity Lift Grid
NewSkeumorphic Music Card
NewSpotlight Grid
NewTexts
NewTrading Card
NewEncryption Decryption
Easily encrypt and decrypt data with secure, hassle-free functions. Whether you're protecting sensitive information or just hiding your secret taco recipe, we've got you covered!
See it in Action 👇🏻
Follow below steps 👇🏻
Secret Key
Copy a secret key using the button below and store it in your .env file or somewhere safe.
Encryption / Decryption Handlers
Secure your data with ease using the functions below. Simply copy and paste them into your code to encrypt sensitive information and decrypt it when needed. No hassle, just seamless security!
import crypto from 'crypto';
const IV_LENGTH = 16;
const CRYPTO_SECRET = <YOUR SECRET KEY>; // Replace with your own secret key
// * Encrypt the payload
const encryptData = (payload) => {
const iv = crypto.randomBytes(IV_LENGTH);
const cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(CRYPTO_SECRET, 'base64'), iv);
let encrypted = cipher.update(JSON.stringify(payload), 'utf8', 'base64');
encrypted += cipher.final('base64');
return { encryptedData: encrypted, iv: iv.toString('base64') };
};
// * Decrypt the payload
const decryptData = (encryptedData, iv) => {
const decipher = crypto.createDecipheriv(
'aes-256-cbc',
Buffer.from(CRYPTO_SECRET, 'base64'),
Buffer.from(iv, 'base64')
);
let decrypted = decipher.update(encryptedData, 'base64', 'utf8');
decrypted += decipher.final('utf8');
return JSON.parse(decrypted);
};