aria-128-ctr encrypt & decrypt online
Encrypt or decrypt text with aria-128-ctr and a secret. Same result as PHP's openssl_encrypt, and nothing leaves your browser.
The bytes behind your result
Your code gives a different result? Almost always the key or the IV differ. Here you see exactly which bytes the tool used for the secret and text in the tool above: copy the key and IV in hex into your own code. Shown for the text hello world and the secret my secret until you type above.
- Key · 16 bytes 9 from your secret, 7 zero bytes added
- 6d792073656372657400000000000000
6d792073656372657400000000000000 - IV · 16 bytes none given, so zero bytes
- 00000000000000000000000000000000
00000000000000000000000000000000 - Text in UTF-8 11 bytes, no padding needed
- 68656c6c6f20776f726c64
- Encrypted · 11 bytes
- 6442a035cae74724b797b3
6442a035cae74724b797b3 - As Base64 what the tool shows
ZEKgNcrnRyS3l7M=
from your inputzero bytesciphertext
What is aria-128-ctr?
ARIA is a block cipher from South Korea (2003), the national standard KS X 1213 and RFC 5794. It has the same interface as AES: 16-byte blocks and 128, 192 or 256-bit keys. ARIA-128-CTR uses a 128-bit key (12 rounds) in Counter mode: an encrypted counter forms a keystream that is XORed with the text.
How your secret becomes the key
ARIA-128-CTR needs exactly 16 bytes (128 bits) of key. The tool takes your secret as UTF-8 bytes and pads it with zero bytes to 16 bytes, or cuts it after 16 bytes.
- South Korean government and banking systems
- TLS cipher suites (RFC 6209)
Is it safe to use?
ARIA. No practical attack on the cipher itself is known.
The setup of this tool is made for compatibility with PHP's openssl_encrypt, not for protecting secrets: the IV is always zero, the secret is used as the key without a key derivation function, and nothing detects changes to the ciphertext.
For real secrets use an authenticated mode such as AES-256-GCM or ChaCha20-Poly1305 with a fresh random nonce for every message, and derive the key from a password with Argon2id, scrypt or PBKDF2. What is a key derivation function?
How CTR mode works
CTR encrypts a counter: the IV, then IV + 1, IV + 2 and so on (OpenSSL counts with the whole 16-byte IV as one big-endian number). The results are XORed with the text. Every block can be computed independently, which makes CTR fast and parallel. GCM is CTR plus an authentication tag.
No padding: output length = input length. Like OFB, the same key and IV always give the same keystream, so a fixed IV must never be reused for different texts in real systems.
The same result in your code
Every snippet prints ZEKgNcrnRyS3l7M= for the text hello world and the secret my secret, the same as the tool. The key and IV are written out in hex, so you can see what the tool does with the secret. Your own key and IV are in What the tool did. All snippets are run against PHP before each release.
$key = hex2bin("6d792073656372657400000000000000"); // "my secret" padded with zero bytes to 16 bytes $iv = hex2bin("00000000000000000000000000000000"); // no IV given: 16 zero bytes echo openssl_encrypt("hello world", "aria-128-ctr", $key, 0, $iv);
Shortest form, same result: openssl_encrypt("hello world", "aria-128-ctr", "my secret"). PHP pads the secret itself but warns about the empty IV.
import { createCipheriv } from 'node:crypto'; const key = Buffer.from("6d792073656372657400000000000000", 'hex'); // "my secret" padded with zero bytes to 16 bytes const iv = Buffer.alloc(16); // no IV given: 16 zero bytes const c = createCipheriv("aria-128-ctr", key, iv); console.log(Buffer.concat([c.update("hello world", 'utf8'), c.final()]).toString('base64'));
printf '%s' 'hello world' | openssl enc -aria-128-ctr -K 6d792073656372657400000000000000 -iv 00000000000000000000000000000000 -a -A
printf instead of echo: echo adds a line break, which changes the result. -K and -iv take hex; with -k or -pass, openssl derives a different key from a password.
Why your aria-128-ctr result doesn't match
Many tutorials turn a password into a key with SHA-256 or MD5. This tool doesn't: it uses the bytes of your secret directly and pads them with zero bytes. Copy the key in hex from What the tool did and use it as the raw key.
With a random IV the result changes every time. The tool uses no IV, which in PHP means zero bytes. Use a zero IV of the right length to get the same result, and keep the random IV for real data.
The tool shows the raw ciphertext bytes as Base64. Many libraries return hex or raw bytes. Convert before comparing, or compare with the hex blocks in What the tool did.
With a zero IV, CFB, OFB and CTR all begin by encrypting the IV, so the first block of output is identical in all three. They only differ from the second block on.
This mode needs no padding: 11 bytes in, 11 bytes out. If your library adds PKCS#7 padding or expects whole blocks, it is configured for CBC or ECB.
Without a nonce, every text encrypted with the same secret uses the same keystream. XOR two ciphertexts and the keystream cancels out, leaving the XOR of the two texts. That's how WEP was broken.
Like the old site, the tool trims spaces and line breaks at the start and end of the text and the secret, and sends line breaks as CRLF (\r\n), as a browser form does. echo "text" | in a shell adds a line break at the end.
Only the first bytes up to the key length count, the rest is cut off. Two secrets that start with the same bytes give the same result. Non-ASCII characters take 2–4 bytes in UTF-8, so they fill the key faster.
Given a password, the openssl command line derives key and IV from it with a random salt (EVP_BytesToKey or PBKDF2), and the output starts with U2FsdGVkX1 ("Salted__"). That is a different format. Pass the key and IV in hex with -K and -iv instead, as in the code example.
Encrypted something here years ago?
Paste the Base64 result and the secret. Your browser tries all 174 ciphers of this site and shows those that give readable text. Useful if you don't remember the cipher, or to check whether your ciphertext really is aria-128-ctr.
Every ARIA-128 variant, same input
The text The quick brown fox jumps over the lazy dog (43 bytes) with the secret my secret in all 10 ARIA-128 ciphers. The last column lists names that give the same result: aliases, and modes that agree for this input. Highlighted: the same start as aria-128-ctr. Watch how CBC and ECB share the first block, and CFB, OFB and CTR the first 16 bytes. Type a text and a secret in the tool above to use yours.
| Cipher | Result (Base64) | Same as |
|---|---|---|
| aria-128-cbc | HBdbKlJbuLh39IGpEujS0s6aJ2naiTmQNopK67QSrz/5EPuZBQOCQrGLMeLG+FhE | aria128 |
| aria-128-ccm | no result | |
| aria-128-cfb | WE+pedSyWSiu27XNm7ijJS/E1Lnqsv6mlDvTa1cY2bvN2wiIfkJTwDDhzg== | |
| aria-128-cfb1 | fo+r+9F0el65V9S2ymT82aYuT7oS/9ZU3apAKBsQqPr1S1yNq3O6FNdsjg== | |
| aria-128-cfb8 | WKyeDZIwWRfisfPqDDxBj+ENFSFq2P/1hV21mRSu+b3reZ/W7FPiw4sB1A== | |
| aria-128-ctr | WE+pedSyWSiu27XNm7ijJYrsGhKi6H+LT2uK93MoE1PSeaQiNU49aMQ4XQ== | |
| aria-128-ecb Legacy | HBdbKlJbuLh39IGpEujS0g4uUoGu7lGnx76em1m3/0qvaGM4W7oh8ccfC9ssI3iY | |
| aria-128-gcm | no result | |
| aria-128-ofb | WE+pedSyWSiu27XNm7ijJQEZBTyUToIKgmMoL0H9Hv6N38f4VHdZXEOzqw== | |
| aria128 | HBdbKlJbuLh39IGpEujS0s6aJ2naiTmQNopK67QSrz/5EPuZBQOCQrGLMeLG+FhE | aria-128-cbc |
aria-128-ctr test values
Results for common test strings with the secret my secret (UTF-8, no line break, zero IV), exactly as the tool and PHP's openssl_encrypt give them. Use them to check your own implementation.
| Text | aria-128-ctr (Base64) |
|---|---|
| empty string | |
a | bQ== |
hello world | ZEKgNcrnRyS3l7M= |
0123456789abcdef | PBb+apHyBnz9wrbdl6uoYw== |
The quick brown fox jumps over the lazy dog | WE+pedSyWSiu27XNm7ijJYrsGhKi6H+LT2uK93MoE1PSeaQiNU49aMQ4XQ== |
Questions about aria-128-ctr
Can aria-128-ctr be decrypted without the secret?
No. Without the secret there is no shortcut. A short or common secret can be guessed, though, because the tool uses it directly as the key.
Why does my aria-128-ctr code give a different result?
Almost always because of the key or the IV: the tool pads your secret with zero bytes instead of hashing it and uses a zero IV. Also check Base64 vs hex, padding, and spaces or line breaks the tool trims.
Why is the aria-128-ctr output shorter than with CBC?
CTR mode needs no padding: the ciphertext has exactly as many bytes as the text, while CBC rounds up to whole blocks.
Is ARIA secure?
ARIA has no practical attack. The weak points of this tool are the setup (zero IV, secret as key, no authentication), not the cipher.
How long should my secret be?
Exactly 16 bytes (128 bits) fills the key; anything after that is ignored. For real security a random key is better than a typed word.