Getting Started
Accordion
Barricade Tape
Buttons
Browser Window
Contact Section
File Stack
Gooey Words
Glowing Dots Background
Image Pile
Jelly Loader
Mask Cursor Effect
NewMagnet Tabs
Masonry Grid
Pixelated Carousel
NewPixelated Text
NewPrismatic Haze Background
Projects Section
Proximity Background
Proximity Lift Grid
Skeumorphic Music Card
Spotlight Grid
Texts
Trading Card
Encryption 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);
};