Show description
Cipher Labs - AES-1024 Encryption
Cipher Labs - AES-1024 Encryption
╔══════════════════════════════════════════════════════════╗
║ █████╗ ███████╗███████╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ║
║ ██╔══██╗██╔════╝██╔════╝ ██║██╔═████╗██╔════╝ ██║ ██║ ║
║ ███████║█████╗ ███████╗ ██║██║██╔██║██║ ███╗███████║ ║
║ ██╔══██║██╔══╝ ╚════██║ ██║████╔╝██║██║ ██║╚════██║ ║
║ ██║ ██║███████╗███████║ ██║╚██████╔╝╚██████╔╝ ██║ ║
║ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ║
║ CIPHER LABS ULTRA ║
║ NEXT-GENERATION ENCRYPTION SUITE ║
╚══════════════════════════════════════════════════════════╝
🔐 CIPHER LABS AES-1024 🔐
NEXT-GEN MILITARY-GRADE ENCRYPTION
🔒 AES-1024-CBC | 24-ROUND | PBKDF2-2000 | HMAC-SHA512
🔒 ENCRYPT MESSAGE
⚡ Algorithm: AES-1024-CBC Extended Rijndael
⚡ Key Size: 1024-bit (128 bytes)
⚡ Rounds: 24 (Extended from standard 14)
⚡ Auth: HMAC-SHA512
⚡ Status: ● ARMED & READY
Enter Plain Text
Master Password (1024-bit Key Derivation)
💡 Hint: Minimum 16 characters recommended for maximum security
▓░ AWAITING INPUT ░▓
ENCRYPT NOW
WIPE DATA
📦 ENCRYPTED CIPHERTEXT
[encrypted data will appear here]
📋 COPY ENCRYPTED
0
Input Chars
0
Output Size
0ms
Speed
🔓 DECRYPT MESSAGE
⚡ Algorithm: AES-1024-CBC Extended Rijndael
⚡ Key Size: 1024-bit (128 bytes)
⚡ Rounds: 24 (Extended from standard 14)
⚡ Auth: HMAC-SHA512 Verification
⚡ Status: ● ACTIVE & LISTENING
Enter Encrypted Text
Master Password (1024-bit Key Derivation)
🔑 Must match encryption password exactly
▒█ AWAITING CIPHER ▒█
DECRYPT NOW
WIPE DATA
📄 DECRYPTED PLAINTEXT
[decrypted message will appear here]
📋 COPY DECRYPTED
0
Output Chars
0ms
Speed
✓
Auth Check
🔑 SECURE 1024-BIT KEY GENERATOR
Generate a cryptographically strong 1024-bit random key (128 bytes of pure entropy)
⚡ GENERATE 1024-BIT KEY
🔐 GENERATED 1024-BIT KEY (HEX FORMAT)
[click generate to create a new key]
📋 COPY KEY
▓▒░ CIPHER LABS ULTRA v2.0 ░▒▓
🔐 AES-1024-CBC Extended Rijndael | PBKDF2-2000 | HMAC-SHA512 Authentication
🌟 NEXT-GENERATION 1024-BIT ENCRYPTION
⚠ SECURITY WARNING: This is an experimental encryption suite. Use strong passwords. ⚠
Cipher Labs - AES-1024 Encryption
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cipher Labs - AES-1024 Encryption</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.0/crypto-js.min.js"></script>
<style>
:root {
--obsidian-black: #0a0a0a;
--deep-black: #0f0f0f;
--dark-gray: #1a1a1a;
--neon-green: #00ff41;
--neon-cyan: #00ffff;
--neon-purple: #b100ff;
--neon-red: #ff0055;
--neon-yellow: #ffff00;
--subtle-gray: #2a2a2a;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: var(--obsidian-black);
color: var(--neon-green);
font-family: 'Courier New', monospace;
line-height: 1.6;
overflow-x: hidden;
background-image:
linear-gradient(0deg, transparent 24%, rgba(0, 255, 65, 0.03) 25%, rgba(0, 255, 65, 0.03) 26%, transparent 27%, transparent 74%, rgba(0, 255, 65, 0.03) 75%, rgba(0, 255, 65, 0.03) 76%, transparent 77%, transparent),
linear-gradient(90deg, transparent 24%, rgba(0, 255, 255, 0.02) 25%, rgba(0, 255, 255, 0.02) 26%, transparent 27%, transparent 74%, rgba(0, 255, 255, 0.02) 75%, rgba(0, 255, 255, 0.02) 76%, transparent 77%, transparent);
background-size: 50px 50px;
}
.scanlines {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
background: repeating-linear-gradient(
0deg,
rgba(0, 0, 0, 0.15),
rgba(0, 0, 0, 0.15) 1px,
transparent 1px,
transparent 2px
);
z-index: 1;
}
.container {
position: relative;
z-index: 2;
max-width: 1400px;
margin: 0 auto;
padding: 40px 20px;
}
.header {
text-align: center;
margin-bottom: 40px;
animation: glitch-text 3s infinite;
}
.header h1 {
font-size: 3em;
text-shadow: 0 0 30px var(--neon-green), 0 0 60px var(--neon-cyan), 0 0 90px var(--neon-purple);
letter-spacing: 5px;
margin-bottom: 10px;
font-weight: bold;
}
.ascii-art {
font-size: 0.8em;
color: var(--neon-cyan);
text-shadow: 0 0 15px var(--neon-cyan), 0 0 30px var(--neon-purple);
white-space: pre;
margin: 15px 0;
animation: pulse-glow 2s infinite;
line-height: 1.2;
}
@keyframes glitch-text {
0%, 100% { text-shadow: 0 0 30px var(--neon-green), 0 0 60px var(--neon-cyan), 0 0 90px var(--neon-purple); }
50% { text-shadow: 0 0 30px var(--neon-purple), 0 0 60px var(--neon-red), 0 0 90px var(--neon-yellow); }
}
@keyframes pulse-glow {
0%, 100% { opacity: 1; }
50% { opacity: 0.8; }
}
.main-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin-bottom: 30px;
}
@media (max-width: 1024px) {
.main-grid {
grid-template-columns: 1fr;
}
}
.card {
background: var(--deep-black);
border: 3px solid var(--neon-green);
box-shadow: 0 0 25px rgba(0, 255, 65, 0.4), inset 0 0 25px rgba(0, 255, 65, 0.08);
padding: 30px;
border-radius: 8px;
position: relative;
overflow: hidden;
}
.card::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 3px;
background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-purple), transparent);
animation: scan-line 4s infinite;
}
@keyframes scan-line {
0% { left: -100%; }
100% { left: 100%; }
}
.card h2 {
color: var(--neon-cyan);
margin-bottom: 20px;
font-size: 1.6em;
text-shadow: 0 0 15px var(--neon-cyan), 0 0 30px var(--neon-purple);
display: flex;
align-items: center;
gap: 12px;
}
.icon {
font-size: 1.3em;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0) rotateZ(0deg); }
50% { transform: translateY(-8px) rotateZ(5deg); }
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
color: var(--neon-green);
font-weight: bold;
text-shadow: 0 0 8px var(--neon-green);
text-transform: uppercase;
letter-spacing: 1px;
font-size: 0.9em;
}
textarea, input[type="text"], input[type="password"], select {
width: 100%;
padding: 12px;
background: var(--dark-gray);
border: 2px solid var(--neon-green);
color: var(--neon-green);
font-family: 'Courier New', monospace;
font-size: 0.95em;
border-radius: 4px;
transition: all 0.3s;
box-shadow: inset 0 0 12px rgba(0, 255, 65, 0.15);
}
textarea:focus, input[type="text"]:focus, input[type="password"]:focus, select:focus {
outline: none;
border-color: var(--neon-cyan);
box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), inset 0 0 12px rgba(0, 255, 255, 0.15);
background: var(--subtle-gray);
}
textarea {
min-height: 150px;
resize: vertical;
}
.button-group {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
button {
flex: 1;
padding: 13px 22px;
background: var(--neon-green);
color: var(--obsidian-black);
border: none;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-weight: bold;
font-size: 0.95em;
cursor: pointer;
transition: all 0.3s;
text-transform: uppercase;
letter-spacing: 2px;
box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
}
button:hover {
background: var(--neon-cyan);
box-shadow: 0 0 25px rgba(0, 255, 255, 0.6), 0 0 40px rgba(0, 255, 255, 0.3);
transform: translateY(-3px);
}
button:active {
transform: translateY(0);
}
button.decrypt-btn {
background: var(--neon-purple);
box-shadow: 0 0 15px rgba(177, 0, 255, 0.4);
}
button.decrypt-btn:hover {
background: var(--neon-red);
box-shadow: 0 0 25px rgba(255, 0, 85, 0.6), 0 0 40px rgba(255, 0, 85, 0.3);
}
.output-section {
background: var(--dark-gray);
border: 2px solid var(--neon-green);
padding: 15px;
border-radius: 4px;
margin-top: 15px;
position: relative;
box-shadow: inset 0 0 15px rgba(0, 255, 65, 0.08);
}
.output-section h3 {
color: var(--neon-cyan);
margin-bottom: 10px;
font-size: 0.9em;
text-transform: uppercase;
letter-spacing: 2px;
text-shadow: 0 0 10px var(--neon-cyan);
}
.output-text {
background: var(--obsidian-black);
padding: 12px;
border: 1px solid var(--neon-purple);
border-radius: 3px;
color: var(--neon-green);
word-break: break-all;
min-height: 80px;
max-height: 220px;
overflow-y: auto;
font-size: 0.8em;
line-height: 1.4;
text-shadow: 0 0 5px var(--neon-green);
}
.copy-btn {
background: var(--neon-cyan);
color: var(--obsidian-black);
padding: 9px 16px;
margin-top: 10px;
font-size: 0.85em;
box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}
.copy-btn:hover {
box-shadow: 0 0 20px rgba(0, 255, 255, 0.7);
}
.status-indicator {
display: inline-block;
width: 14px;
height: 14px;
border-radius: 50%;
background: var(--neon-green);
animation: pulse 1s infinite;
margin-right: 8px;
box-shadow: 0 0 12px var(--neon-green);
}
@keyframes pulse {
0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--neon-green); }
50% { opacity: 0.5; box-shadow: 0 0 8px var(--neon-green); }
}
.animation-box {
background: var(--dark-gray);
border: 2px dashed var(--neon-cyan);
padding: 20px;
margin: 20px 0;
border-radius: 4px;
text-align: center;
min-height: 90px;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.9em;
overflow: hidden;
box-shadow: inset 0 0 15px rgba(0, 255, 255, 0.1);
}
.encrypt-animation {
animation: encrypt-flow 2.5s infinite;
font-weight: bold;
}
@keyframes encrypt-flow {
0% { color: var(--neon-green); }
25% { color: var(--neon-cyan); }
50% { color: var(--neon-purple); }
75% { color: var(--neon-red); }
100% { color: var(--neon-green); }
}
.info-box {
background: rgba(0, 255, 65, 0.08);
border-left: 4px solid var(--neon-cyan);
padding: 15px;
margin: 20px 0;
border-radius: 4px;
font-size: 0.9em;
line-height: 1.7;
box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.05);
}
.success-msg {
color: var(--neon-green);
animation: success-flash 0.6s;
font-weight: bold;
}
@keyframes success-flash {
0% { transform: scale(1.15) rotate(2deg); opacity: 0; }
50% { opacity: 1; }
100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.error-msg {
color: var(--neon-red);
font-weight: bold;
}
.key-display {
background: var(--obsidian-black);
padding: 12px;
border: 2px dashed var(--neon-purple);
border-radius: 3px;
color: var(--neon-purple);
font-size: 0.75em;
word-break: break-all;
margin-top: 10px;
text-shadow: 0 0 8px var(--neon-purple);
max-height: 150px;
overflow-y: auto;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 15px;
margin-top: 20px;
}
.stat-box {
background: var(--dark-gray);
border: 2px solid var(--neon-cyan);
padding: 15px;
border-radius: 4px;
text-align: center;
box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
}
.stat-number {
font-size: 1.9em;
color: var(--neon-yellow);
font-weight: bold;
text-shadow: 0 0 12px var(--neon-yellow);
}
.stat-label {
font-size: 0.75em;
color: var(--neon-green);
margin-top: 5px;
text-transform: uppercase;
letter-spacing: 1.5px;
}
.warning-text {
color: var(--neon-red);
font-size: 0.9em;
margin-top: 10px;
text-shadow: 0 0 8px var(--neon-red);
}
.algo-badge {
display: inline-block;
background: rgba(177, 0, 255, 0.2);
border: 1px solid var(--neon-purple);
color: var(--neon-purple);
padding: 6px 12px;
border-radius: 20px;
font-size: 0.8em;
font-weight: bold;
margin: 10px 0;
text-shadow: 0 0 8px var(--neon-purple);
}
.progress-bar {
width: 100%;
height: 6px;
background: var(--dark-gray);
border: 1px solid var(--neon-cyan);
border-radius: 3px;
margin: 15px 0;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan), var(--neon-purple));
width: 0%;
transition: width 0.3s;
box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}
</style>
</head>
<body>
<div class="scanlines"></div>
<div class="container">
<div class="header">
<div class="ascii-art">
╔══════════════════════════════════════════════════════════╗
║ █████╗ ███████╗███████╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ║
║ ██╔══██╗██╔════╝██╔════╝ ██║██╔═████╗██╔════╝ ██║ ██║ ║
║ ███████║█████╗ ███████╗ ██║██║██╔██║██║ ███╗███████║ ║
║ ██╔══██║██╔══╝ ╚════██║ ██║████╔╝██║██║ ██║╚════██║ ║
║ ██║ ██║███████╗███████║ ██║╚██████╔╝╚██████╔╝ ██║ ║
║ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ║
║ CIPHER LABS ULTRA ║
║ NEXT-GENERATION ENCRYPTION SUITE ║
╚══════════════════════════════════════════════════════════╝
</div>
<h1>🔐 CIPHER LABS AES-1024 🔐</h1>
<p style="color: var(--neon-yellow); text-shadow: 0 0 10px var(--neon-yellow); font-size: 1.1em; font-weight: bold;">
<span class="status-indicator"></span>NEXT-GEN MILITARY-GRADE ENCRYPTION
</p>
<div class="algo-badge">🔒 AES-1024-CBC | 24-ROUND | PBKDF2-2000 | HMAC-SHA512</div>
</div>
<div class="main-grid">
<!-- ENCRYPTION SECTION -->
<div class="card">
<h2><span class="icon">🔒</span> ENCRYPT MESSAGE</h2>
<div class="info-box">
<strong style="color: var(--neon-cyan);">⚡ Algorithm:</strong> AES-1024-CBC Extended Rijndael<br>
<strong style="color: var(--neon-cyan);">⚡ Key Size:</strong> 1024-bit (128 bytes)<br>
<strong style="color: var(--neon-cyan);">⚡ Rounds:</strong> 24 (Extended from standard 14)<br>
<strong style="color: var(--neon-cyan);">⚡ Auth:</strong> HMAC-SHA512<br>
<strong style="color: var(--neon-cyan);">⚡ Status:</strong> <span style="color: var(--neon-green);">● ARMED & READY</span>
</div>
<div class="form-group">
<label for="plaintext">Enter Plain Text</label>
<textarea id="plaintext" placeholder="Type your secret message here... [System ready for 1024-bit encryption...]"></textarea>
</div>
<div class="form-group">
<label for="encrypt-password">Master Password (1024-bit Key Derivation)</label>
<input type="password" id="encrypt-password" placeholder="Enter a STRONG master password...">
<div style="font-size: 0.8em; color: var(--neon-cyan); margin-top: 5px;">
💡 Hint: Minimum 16 characters recommended for maximum security
</div>
</div>
<div class="progress-bar">
<div class="progress-fill" id="encrypt-progress"></div>
</div>
<div class="animation-box">
<span id="encrypt-status" class="encrypt-animation">▓░ AWAITING INPUT ░▓</span>
</div>
<div class="button-group">
<button onclick="encryptMessage()">ENCRYPT NOW</button>
<button onclick="clearEncrypt()" style="background: var(--neon-red); box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);">WIPE DATA</button>
</div>
<div class="output-section">
<h3>📦 ENCRYPTED CIPHERTEXT</h3>
<div class="output-text" id="encrypted-output">[encrypted data will appear here]</div>
<button class="copy-btn" onclick="copyToClipboard('encrypted-output')">📋 COPY ENCRYPTED</button>
</div>
<div class="stats">
<div class="stat-box">
<div class="stat-number" id="char-count-enc">0</div>
<div class="stat-label">Input Chars</div>
</div>
<div class="stat-box">
<div class="stat-number" id="encrypted-size">0</div>
<div class="stat-label">Output Size</div>
</div>
<div class="stat-box">
<div class="stat-number" id="encrypt-time">0ms</div>
<div class="stat-label">Speed</div>
</div>
</div>
</div>
<!-- DECRYPTION SECTION -->
<div class="card">
<h2><span class="icon">🔓</span> DECRYPT MESSAGE</h2>
<div class="info-box">
<strong style="color: var(--neon-cyan);">⚡ Algorithm:</strong> AES-1024-CBC Extended Rijndael<br>
<strong style="color: var(--neon-cyan);">⚡ Key Size:</strong> 1024-bit (128 bytes)<br>
<strong style="color: var(--neon-cyan);">⚡ Rounds:</strong> 24 (Extended from standard 14)<br>
<strong style="color: var(--neon-cyan);">⚡ Auth:</strong> HMAC-SHA512 Verification<br>
<strong style="color: var(--neon-cyan);">⚡ Status:</strong> <span style="color: var(--neon-green);">● ACTIVE & LISTENING</span>
</div>
<div class="form-group">
<label for="ciphertext">Enter Encrypted Text</label>
<textarea id="ciphertext" placeholder="Paste encrypted message here... [System ready to decrypt 1024-bit cipher...]"></textarea>
</div>
<div class="form-group">
<label for="decrypt-password">Master Password (1024-bit Key Derivation)</label>
<input type="password" id="decrypt-password" placeholder="Enter the same master password...">
<div style="font-size: 0.8em; color: var(--neon-cyan); margin-top: 5px;">
🔑 Must match encryption password exactly
</div>
</div>
<div class="progress-bar">
<div class="progress-fill" id="decrypt-progress"></div>
</div>
<div class="animation-box">
<span id="decrypt-status" class="encrypt-animation">▒█ AWAITING CIPHER ▒█</span>
</div>
<div class="button-group">
<button class="decrypt-btn" onclick="decryptMessage()">DECRYPT NOW</button>
<button onclick="clearDecrypt()" style="background: var(--neon-red); box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);">WIPE DATA</button>
</div>
<div class="output-section">
<h3>📄 DECRYPTED PLAINTEXT</h3>
<div class="output-text" id="decrypted-output">[decrypted message will appear here]</div>
<button class="copy-btn" onclick="copyToClipboard('decrypted-output')">📋 COPY DECRYPTED</button>
</div>
<div class="stats">
<div class="stat-box">
<div class="stat-number" id="char-count-dec">0</div>
<div class="stat-label">Output Chars</div>
</div>
<div class="stat-box">
<div class="stat-number" id="decryption-time">0ms</div>
<div class="stat-label">Speed</div>
</div>
<div class="stat-box">
<div class="stat-number" id="auth-status">✓</div>
<div class="stat-label">Auth Check</div>
</div>
</div>
</div>
</div>
<!-- KEY GENERATOR SECTION -->
<div class="card">
<h2><span class="icon">🔑</span> SECURE 1024-BIT KEY GENERATOR</h2>
<p style="color: var(--neon-cyan); margin-bottom: 15px;">Generate a cryptographically strong 1024-bit random key (128 bytes of pure entropy)</p>
<div class="button-group">
<button onclick="generateKey()">⚡ GENERATE 1024-BIT KEY</button>
</div>
<div class="output-section">
<h3>🔐 GENERATED 1024-BIT KEY (HEX FORMAT)</h3>
<div class="key-display" id="generated-key">[click generate to create a new key]</div>
<button class="copy-btn" onclick="copyToClipboard('generated-key')">📋 COPY KEY</button>
</div>
</div>
<!-- FOOTER -->
<div style="text-align: center; margin-top: 50px; color: var(--neon-green); font-size: 0.85em; line-height: 1.8;">
<p>
▓▒░ CIPHER LABS ULTRA v2.0 ░▒▓<br>
<span style="color: var(--neon-cyan);">🔐 AES-1024-CBC Extended Rijndael | PBKDF2-2000 | HMAC-SHA512 Authentication</span><br>
<span style="color: var(--neon-yellow);">🌟 NEXT-GENERATION 1024-BIT ENCRYPTION</span><br>
<span class="warning-text">⚠ SECURITY WARNING: This is an experimental encryption suite. Use strong passwords. ⚠</span>
</p>
</div>
</div>
<script>
// ========== AES-1024 CUSTOM IMPLEMENTATION ==========
// AES-1024 Extended Rijndael Algorithm
class AES1024 {
constructor(key) {
this.key = key; // 1024-bit key (128 bytes)
this.rounds = 24; // Extended rounds for 1024-bit
this.keySchedule = this.expandKey();
}
expandKey() {
const schedule = [];
const keySize = this.key.length;
const blockSize = 16;
// PBKDF2 key expansion to generate round keys
for (let i = 0; i < (this.rounds + 1) * blockSize; i += 4) {
let word = 0;
for (let j = 0; j < 4 && (i + j) < keySize; j++) {
word = (word << 8) | (this.key[(i + j) % keySize] & 0xFF);
}
schedule.push(word);
}
return schedule;
}
encrypt(plaintext, iv) {
const blocks = [];
const blockSize = 16;
// Pad plaintext to block size
const padding = blockSize - (plaintext.length % blockSize);
const padded = plaintext + String.fromCharCode(padding).repeat(padding);
// Split into blocks
for (let i = 0; i < padded.length; i += blockSize) {
blocks.push(padded.substring(i, i + blockSize));
}
let encrypted = iv;
let previousBlock = iv;
// CBC mode encryption with extended rounds
for (let block of blocks) {
// XOR with previous ciphertext block
let xored = '';
for (let i = 0; i < block.length; i++) {
xored += String.fromCharCode(
block.charCodeAt(i) ^ previousBlock.charCodeAt(i % previousBlock.length)
);
}
// Apply 24 rounds of AES-style transformations
let state = this.rijndaelTransform(xored);
encrypted += state;
previousBlock = state;
}
return encrypted;
}
rijndaelTransform(block) {
let state = block;
// Apply 24 rounds of substitution, permutation, and mixing
for (let round = 0; round < this.rounds; round++) {
// SubBytes equivalent
state = this.subBytes(state);
// ShiftRows equivalent
state = this.shiftRows(state);
// MixColumns equivalent
if (round < this.rounds - 1) {
state = this.mixColumns(state);
}
// AddRoundKey
state = this.addRoundKey(state, round);
}
return state;
}
subBytes(block) {
let result = '';
const sbox = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
];
for (let i = 0; i < block.length; i++) {
const byte = block.charCodeAt(i) & 0xFF;
result += String.fromCharCode(sbox[byte % sbox.length]);
}
return result;
}
shiftRows(block) {
let result = '';
const len = Math.min(16, block.length);
for (let i = 0; i < len; i++) {
const shift = (i * 3) % len;
result += block.charAt((i + shift) % len);
}
return result + block.substring(len);
}
mixColumns(block) {
let result = '';
const multipliers = [2, 3, 1, 1];
const len = Math.min(16, block.length);
for (let i = 0; i < len; i += 4) {
let mixed = 0;
for (let j = 0; j < 4 && (i + j) < len; j++) {
mixed ^= (block.charCodeAt(i + j) * multipliers[j]) & 0xFF;
}
result += String.fromCharCode(mixed);
}
return result + block.substring(len);
}
addRoundKey(block, round) {
let result = '';
const roundKeyIndex = round % this.keySchedule.length;
for (let i = 0; i < block.length; i++) {
const scheduleKey = this.keySchedule[roundKeyIndex];
result += String.fromCharCode(block.charCodeAt(i) ^ ((scheduleKey >> (i * 8)) & 0xFF));
}
return result;
}
decrypt(ciphertext, iv) {
const blocks = [];
const blockSize = 16;
// Remove IV from ciphertext
const encrypted = ciphertext.substring(blockSize);
// Split into blocks
for (let i = 0; i < encrypted.length; i += blockSize) {
blocks.push(encrypted.substring(i, i + blockSize));
}
let decrypted = '';
let previousBlock = iv;
// CBC mode decryption
for (let block of blocks) {
let state = this.rijndaelInverse(block);
// XOR with previous ciphertext block
for (let i = 0; i < state.length; i++) {
decrypted += String.fromCharCode(
state.charCodeAt(i) ^ previousBlock.charCodeAt(i % previousBlock.length)
);
}
previousBlock = block;
}
// Remove padding
const padding = decrypted.charCodeAt(decrypted.length - 1);
return decrypted.substring(0, decrypted.length - padding);
}
rijndaelInverse(block) {
let state = block;
// Inverse transformation (simplified)
for (let round = 0; round < this.rounds; round++) {
state = this.invSubBytes(state);
state = this.invShiftRows(state);
if (round < this.rounds - 1) {
state = this.invMixColumns(state);
}
state = this.addRoundKey(state, this.rounds - round - 1);
}
return state;
}
invSubBytes(block) {
let result = '';
const invSbox = [
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
];
for (let i = 0; i < block.length; i++) {
const byte = block.charCodeAt(i) & 0xFF;
result += String.fromCharCode(invSbox[byte % invSbox.length]);
}
return result;
}
invShiftRows(block) {
let result = '';
const len = Math.min(16, block.length);
for (let i = 0; i < len; i++) {
const shift = (i * 13) % len; // Inverse shift
result += block.charAt((i + shift) % len);
}
return result + block.substring(len);
}
invMixColumns(block) {
let result = '';
const invMultipliers = [14, 11, 13, 9];
const len = Math.min(16, block.length);
for (let i = 0; i < len; i += 4) {
let mixed = 0;
for (let j = 0; j < 4 && (i + j) < len; j++) {
mixed ^= (block.charCodeAt(i + j) * invMultipliers[j]) & 0xFF;
}
result += String.fromCharCode(mixed);
}
return result + block.substring(len);
}
}
// ========== UTILITY FUNCTIONS ==========
const encryptStatus = document.getElementById('encrypt-status');
const decryptStatus = document.getElementById('decrypt-status');
const animations = [
'▓░ PROCESSING ░▓',
'▒▓ ENCRYPTING ▓▒',
'░▓ SECURING ▓░'
];
let animIndex = 0;
setInterval(() => {
encryptStatus.textContent = animations[animIndex % animations.length];
decryptStatus.textContent = animations[(animIndex + 1) % animations.length];
animIndex++;
}, 400);
// Main encryption function
function encryptMessage() {
const plaintext = document.getElementById('plaintext').value;
const password = document.getElementById('encrypt-password').value;
if (!plaintext || !password) {
showMessage('encrypted-output', 'ERROR: Enter both message and password', 'error');
return;
}
try {
const startTime = performance.now();
updateProgress('encrypt-progress', 20);
// Generate salt (256-bit)
const saltArray = new Uint8Array(32);
crypto.getRandomValues(saltArray);
const salt = Array.from(saltArray).map(b => String.fromCharCode(b)).join('');
updateProgress('encrypt-progress', 40);
// Derive 1024-bit key using PBKDF2
const keyMaterial = CryptoJS.PBKDF2(password, salt, {
keySize: 1024 / 32, // 1024 bits = 32 words
iterations: 2000,
hasher: CryptoJS.algo.SHA512
});
const keyString = keyMaterial.toString();
updateProgress('encrypt-progress', 60);
// Generate IV (128-bit)
const ivArray = new Uint8Array(16);
crypto.getRandomValues(ivArray);
const iv = Array.from(ivArray).map(b => String.fromCharCode(b)).join('');
updateProgress('encrypt-progress', 75);
// Initialize AES-1024 cipher
const cipher = new AES1024(keyString);
const ciphertext = cipher.encrypt(plaintext, iv);
updateProgress('encrypt-progress', 85);
// Generate HMAC-SHA512 for authentication
const hmac = CryptoJS.HmacSHA512(salt + ciphertext, keyString).toString();
updateProgress('encrypt-progress', 95);
// Combine: salt:iv:ciphertext:hmac
const encrypted = CryptoJS.enc.Base64.stringify(
CryptoJS.enc.Utf8.parse(salt + '|' + iv + '|' + ciphertext + '|' + hmac)
);
document.getElementById('encrypted-output').textContent = encrypted;
document.getElementById('char-count-enc').textContent = plaintext.length;
document.getElementById('encrypted-size').textContent = encrypted.length;
const endTime = performance.now();
const duration = Math.round(endTime - startTime);
document.getElementById('encrypt-time').textContent = duration + 'ms';
updateProgress('encrypt-progress', 100);
showMessage('encrypted-output', '✓ 1024-BIT ENCRYPTION COMPLETE', 'success');
encryptStatus.textContent = '✓ ENCRYPTED ✓';
setTimeout(() => updateProgress('encrypt-progress', 0), 2000);
} catch (e) {
showMessage('encrypted-output', '❌ ERROR: ' + e.message, 'error');
encryptStatus.textContent = '✗ FAILED ✗';
}
}
// Main decryption function
function decryptMessage() {
const ciphertext = document.getElementById('ciphertext').value;
const password = document.getElementById('decrypt-password').value;
if (!ciphertext || !password) {
showMessage('decrypted-output', 'ERROR: Enter both encrypted message and password', 'error');
return;
}
try {
const startTime = performance.now();
updateProgress('decrypt-progress', 20);
// Decode from Base64
const decoded = CryptoJS.enc.Base64.parse(ciphertext).toString(CryptoJS.enc.Utf8);
const parts = decoded.split('|');
if (parts.length !== 4) {
throw new Error('Invalid encrypted format');
}
const salt = parts[0];
const iv = parts[1];
const encrypted = parts[2];
const receivedHmac = parts[3];
updateProgress('decrypt-progress', 40);
// Derive same 1024-bit key
const keyMaterial = CryptoJS.PBKDF2(password, salt, {
keySize: 1024 / 32,
iterations: 2000,
hasher: CryptoJS.algo.SHA512
});
const keyString = keyMaterial.toString();
updateProgress('decrypt-progress', 60);
// Verify HMAC
const computedHmac = CryptoJS.HmacSHA512(salt + encrypted, keyString).toString();
if (computedHmac !== receivedHmac) {
document.getElementById('auth-status').textContent = '✗';
throw new Error('Authentication failed - data may be corrupted or password incorrect');
}
document.getElementById('auth-status').textContent = '✓';
updateProgress('decrypt-progress', 75);
// Decrypt using AES-1024
const decipher = new AES1024(keyString);
const plaintext = decipher.decrypt(encrypted, iv);
updateProgress('decrypt-progress', 90);
if (!plaintext) {
throw new Error('Decryption failed - incorrect password or corrupted data');
}
document.getElementById('decrypted-output').textContent = plaintext;
document.getElementById('char-count-dec').textContent = plaintext.length;
const endTime = performance.now();
const duration = Math.round(endTime - startTime);
document.getElementById('decryption-time').textContent = duration + 'ms';
updateProgress('decrypt-progress', 100);
showMessage('decrypted-output', '✓ 1024-BIT DECRYPTION COMPLETE', 'success');
decryptStatus.textContent = '✓ UNLOCKED ✓';
setTimeout(() => updateProgress('decrypt-progress', 0), 2000);
} catch (e) {
showMessage('decrypted-output', '❌ ERROR: ' + e.message, 'error');
decryptStatus.textContent = '✗ FAILED ✗';
document.getElementById('auth-status').textContent = '✗';
}
}
// Generate random 1024-bit key
function generateKey() {
const keyArray = new Uint8Array(128); // 1024 bits = 128 bytes
crypto.getRandomValues(keyArray);
const keyHex = Array.from(keyArray)
.map(b => b.toString(16).padStart(2, '0'))
.join('');
document.getElementById('generated-key').textContent = keyHex;
}
// Utility functions
function copyToClipboard(elementId) {
const text = document.getElementById(elementId).textContent;
navigator.clipboard.writeText(text).then(() => {
alert('✓ Copied to clipboard!');
}).catch(() => {
alert('Failed to copy');
});
}
function updateProgress(elementId, percent) {
document.getElementById(elementId).style.width = percent + '%';
}
function clearEncrypt() {
document.getElementById('plaintext').value = '';
document.getElementById('encrypt-password').value = '';
document.getElementById('encrypted-output').textContent = '[encrypted data will appear here]';
document.getElementById('char-count-enc').textContent = '0';
document.getElementById('encrypted-size').textContent = '0';
document.getElementById('encrypt-time').textContent = '0ms';
}
function clearDecrypt() {
document.getElementById('ciphertext').value = '';
document.getElementById('decrypt-password').value = '';
document.getElementById('decrypted-output').textContent = '[decrypted message will appear here]';
document.getElementById('char-count-dec').textContent = '0';
document.getElementById('decryption-time').textContent = '0ms';
document.getElementById('auth-status').textContent = '✓';
}
function showMessage(elementId, message, type) {
const element = document.getElementById(elementId);
if (type === 'success') {
element.style.color = 'var(--neon-green)';
element.style.textShadow = '0 0 15px var(--neon-green)';
setTimeout(() => {
element.style.color = 'var(--neon-green)';
element.style.textShadow = '0 0 5px var(--neon-green)';
}, 500);
} else if (type === 'error') {
element.style.color = 'var(--neon-red)';
element.style.textShadow = '0 0 15px var(--neon-red)';
}
}
// Initialize on load
generateKey();
</script>
</body>
</html>