کل کد را کپی کن و paste کن توی یه فایل با پسوند html مثل index.html حالا دوبار روش کلید کن و توی مرورگرت باز میشه بدون نیاز به دانش خاصی میتونی پیاماتو رمزنگاری کنی و با خیال راحت هر جایی بفرستی دیگه کسی به جز فرستنده و گیرنده نمیتونه محتواشون را بخونه

<!DOCTYPE html> <html lang="fa"> <head> <meta charset="UTF-8"> <title>Hybrid Encryption Tool</title> <style> body { font-family: sans-serif; background: #f3f5f7; padding: 20px; } .box { background: #fff; padding: 20px; margin-bottom: 30px; border-radius: 6px; } textarea { width: 100%; min-height: 120px; margin-top: 6px; font-family: monospace; } button { margin-top: 10px; padding: 8px 14px; } h2 { margin-top: 0; } </style> </head> <body> <h1>🔐 رمزنگاری پیام طولانی (Hybrid RSA + AES)</h1> <div class="box"> <h2>1) تولید کلید</h2> <button ="generateKeys()">Generate RSA Keys</button> <p>Public Key (ارسال به دیگران)</p> <textarea id="pub"></textarea> <p>Private Key (محرمانه)</p> <textarea id="priv"></textarea> </div> <div class="box"> <h2>2) رمزنگاری پیام طولانی</h2> <p>Public Key گیرنده</p> <textarea id="encPub"></textarea> <p>پیام (تا چند هزار کاراکتر)</p> <textarea id="plain"></textarea> <button ="encrypt()">Encrypt</button> <p>خروجی رمز شده (کپی و ارسال)</p> <textarea id="cipher"></textarea> </div> <div class="box"> <h2>3) رمزگشایی</h2> <p>پیام رمز شده</p> <textarea id="cipherIn"></textarea> <p>Private Key</p> <textarea id="privIn"></textarea> <button ="decrypt()">Decrypt</button> <p>پیام اصلی</p> <textarea id="plainOut"></textarea> </div> const enc = new TextEncoder(); const dec = new TextDecoder(); function b64(buf) { return btoa(String.fromCharCode(...new Uint8Array(buf))); } function ub64(b) { return Uint8Array.from(atob(b), c => c.charCodeAt(0)); } async function generateKeys() { const keys = await crypto.subtle.generateKey( { name: "RSA-OAEP", modulusLength: 2048, publicExponent: new Uint8Array([1,0,1]), hash: "SHA-256" }, true, ["encrypt", "decrypt"] ); document.getElementById("pub").value = b64(await crypto.subtle.exportKey("spki", keys.publicKey)); document.getElementById("priv").value = b64(await crypto.subtle.exportKey("pkcs8", keys.privateKey)); } async function encrypt() { const publicKey = await crypto.subtle.importKey( "spki", ub64(document.getElementById("encPub").value.trim()), { name: "RSA-OAEP", hash: "SHA-256" }, false, ["encrypt"] ); const aesKey = await crypto.subtle.generateKey( { name: "AES-GCM", length: 256 }, true, ["encrypt", "decrypt"] ); const iv = crypto.getRandomValues(new Uint8Array(12)); const encryptedMessage = await crypto.subtle.encrypt( { name: "AES-GCM", iv }, aesKey, enc.encode(document.getElementById("plain").value) ); const encryptedAesKey = await crypto.subtle.encrypt( { name: "RSA-OAEP" }, publicKey, await crypto.subtle.exportKey("raw", aesKey) ); const payload = { key: b64(encryptedAesKey), iv: b64(iv), msg: b64(encryptedMessage) }; document.getElementById("cipher").value = btoa(JSON.stringify(payload)); } async function decrypt() { const payload = JSON.parse(atob(document.getElementById("cipherIn").value.trim())); const privateKey = await crypto.subtle.importKey( "pkcs8", ub64(document.getElementById("privIn").value.trim()), { name: "RSA-OAEP", hash: "SHA-256" }, false, ["decrypt"] ); const rawAes = await crypto.subtle.decrypt( { name: "RSA-OAEP" }, privateKey, ub64(payload.key) ); const aesKey = await crypto.subtle.importKey( "raw", rawAes, { name: "AES-GCM" }, false, ["decrypt"] ); const decrypted = await crypto.subtle.decrypt( { name: "AES-GCM", iv: ub64(payload.iv) }, aesKey, ub64(payload.msg) ); document.getElementById("plainOut").value = dec.decode(decrypted); } </body> </html>