Author: Svetlin Nakov
December 26, 2011
Few day ago I needed a JavaScript AES implementation (the Rijndael advanced encryption algorithm) which I can test instantly in my Web browser (two fields “text” and “password” and “encrypt” button). I searched for “online AES tool” but found nothing that is ready-to-use so I needed to write one. For those who need instant online Browser-based JavaScript AES encryptor / decryptor that runs without any plugins client-side, enjoy! Thanks to Mark Percival for his AES JavaScript library.
How the JavaScript AES Encryptor / Decryptor Works?
This online form encrypts with AES (Rijndael) instantly given text with the AES-128 algorithm and produces a BASE64-encoded output: cipher = BASE64_Encode(AES_Encrypt(text, password)). The algorithm first extracts a 128-bit secret key and AES IV (initial vector) from the password and then after padding the input encrypts it (by 128-bit blocks). Finally the encrypted binary result is encoded in BASE64. A random salt is injected along with the password to strengthen the encryption code. The key-extraction algorithm and the format of the output AES-encrypted message is compatible with OpenSSL.
The decryption algorithm first decodes the BASE64 string, extracts from it the random salt used during the encryption, extracts the AES key and IV from the password and the salt and decrypts back the encrypted text.
The encryption / decryption implementation of the AES (Advanced Encryption Standard, a.k.a. Rijndael) algorithm in JavaScript is written by Mark Percival (see his open-source project gibberish-aes at GitHub).
AES Online Encryption Tool – Source Code
Below is the source code of the online AES encryption tool:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/mdp/gibberish-aes/master/src/gibberish-aes.js"></script>
<title>Free Online AES Tool - Encrypt / Decrypt Text with AES Online</title>
</head>
<body>
<h1>Online AES Encryptor / Decryptor - Free AES Tool</h1>
<h2>(JavaScript client-side AES cipher implementation)</h2>
<table>
<tr>
<td>Text to encrypt:</td>
<td><textarea id="text" />Enter the text to be encrypted here...</textarea></td>
</tr>
<tr>
<td>Password:</td>
<td><input id="password" value="some password" /></td>
</tr>
<tr>
<td>Encrypted text:</td>
<td><textarea id="encryptedText" readonly="readonly"></textarea></td>
</tr>
<tr>
<td>Decrypted text:</td>
<td><textarea id="decryptedText" readonly="readonly"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center">
<button id="buttonStart">AES Encrypt / Decrypt</button>
</td>
</tr>
</table>
<script>
$('#buttonStart').click(function() {
var text = $('#text').val();
var pass = $('#password').val();
GibberishAES.size(128);
var encrypted = GibberishAES.enc(text, pass);
$('#encryptedText').val(encrypted);
var decrypted = GibberishAES.dec(encrypted, pass);
$('#decryptedText').val(decrypted);
});
</script>
</body>
</html>
Tags: 128-bit AES encryption tool, AES, AES crypt online, AES decrypt, AES encrypt, AES encrypt text by password, AES encryption online, AES encryption tool online, AES example, AES in JavaScript, AES JavaScript, AES online decryption, AES online encryption, AES online tool, AES OpenSSL, AES tool, AES tool online, BASE64, browser-based AES tool, EAS cipher online, encrypt and decrypt with AES online, encryption algorithm online, free AES tool online, free online AES tool, instant AES encryption, JavaScript AES calculator, online encryption tool, OpenSSL, Rijndael AES, Rijndael AES tool, Rijndael online tool, Web browser AES tool