rc5-ecb encrypt & decrypt online

Legacy

Encrypt or decrypt text with rc5-ecb and a secret. Same result as PHP's openssl_encrypt, and nothing leaves your browser.

Shorter secrets are padded with zero bytes to 16 bytes.
Runs in your browser
What the tool did

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
not used by this mode
Text in UTF-8 11 bytes of text + 5 bytes PKCS#7 padding (value 05) = 16 bytes, 2 blocks of 8
68656c6c6f20776f
726c640505050505
Encrypted · 16 bytes
cbe40da7aa8edf72
deea98758c763932
cbe40da7aa8edf72deea98758c763932
As Base64 what the tool shows
y+QNp6qO33Le6ph1jHY5Mg==

from your inputzero bytespaddingciphertext

In short

What is rc5-ecb?

RC5 is a block cipher by Ron Rivest (1994) with variable block size, rounds and key length. OpenSSL uses 8-byte blocks and 12 rounds, a setting with known theoretical attacks. RC5-ECB uses a 128-bit key (12 rounds) in Electronic Codebook mode: every block is encrypted on its own, so equal blocks give equal output.

LegacyRC5 (RC5-32/12/16): Not broken in everyday use, but outdated. Use it to match old systems, not for new ones.

How your secret becomes the key

The default key length is 16 bytes (128 bits). Shorter secrets are padded with zero bytes to 16 bytes. Longer secrets are used in full, because RC5 accepts variable key lengths.

Where you meet RC5
  • The RSA Secret-Key Challenges, cracked by distributed.net
  • Teaching (data-dependent rotations)
Honest answer

Is it safe to use?

The cipher: legacy

RC5. Not broken in everyday use, but outdated. Use it to match old systems, not for new ones.

This setup: for compatibility

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?

Electronic Codebook

How ECB mode works

ECB encrypts each 8-byte block separately with the same key. There is no IV and no chaining.

Equal plaintext blocks therefore give equal ciphertext blocks. Patterns in the data stay visible, the classic example is an encrypted image whose outlines you can still see. Never use ECB for more than one block of real data.

Like CBC, ECB pads the last block with PKCS#7, so the output is a multiple of 8 bytes.

Original: 144 blocks of 8 bytes
rc5-ecb
rc5-cbc

Really calculated: each square is one 8-byte block, coloured by the first byte of its ciphertext. With ECB, equal blocks stay equal and the heart shows through. With CBC, every block depends on the one before.

Use it in code

The same result in your code

Every snippet prints y+QNp6qO33Le6ph1jHY5Mg== 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.

PHP
$key = hex2bin("6d792073656372657400000000000000"); // "my secret" padded with zero bytes to 16 bytes
echo openssl_encrypt("hello world", "rc5-ecb", $key, 0);

Shortest form, same result: openssl_encrypt("hello world", "rc5-ecb", "my secret"). PHP pads the secret itself but warns about the empty IV. Needs an OpenSSL build that includes RC5; many Linux distributions leave it out.

Common mistakes

Why your rc5-ecb result doesn't match

You hashed the secret first

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.

Hex instead of Base64

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.

Zero padding instead of PKCS#7

The tool pads with PKCS#7 (OpenSSL's default). Some libraries pad with zeros or not at all. A text of exactly one block still gets a full block of padding (10 10 … 10 for 16-byte blocks).

Same result as ECB for short texts

With a zero IV, the first CBC block is exactly the ECB block, because XOR with zeros changes nothing. Texts up to one block long (15 bytes plus padding) give the same result in CBC and ECB. From the second block on they differ, see the family comparison.

Spaces and line breaks

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.

"unsupported" in OpenSSL 3

OpenSSL 3 moved this cipher to the legacy provider. Node.js, PHP, Python and the openssl command line built on OpenSSL 3 report it as unsupported until the legacy provider is loaded (node --openssl-legacy-provider, openssl enc -provider legacy -provider default).

openssl enc with -k or -pass

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.

Which cipher was it?

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 rc5-ecb.

Nothing is sent anywhere. Wrong secrets give no readable text.
Compare

Every RC2, RC4 and RC5 variant, same input

The text The quick brown fox jumps over the lazy dog (43 bytes) with the secret my secret in all 18 RC2, RC4 and RC5 ciphers. The last column lists names that give the same result: aliases, and modes that agree for this input. Highlighted: the same start as rc5-ecb. Watch how CBC and ECB share the first block, and CFB, OFB and CTR the first 8 bytes. Type a text and a secret in the tool above to use yours.

CipherResult (Base64)Same as
rc5 b0Y75AkCYLUjsca/h8U/zTxswBXuXVVjTtwSzRpjQYzWOrTgZm3mOaxPrZBurSxlrc5-cbc
rc2 Legacyp23M7j59Qn+e1KoNAtgQuW4OBtsGuOZx99mLhg3ckwivFbqatlDn7SYam7SSluSgrc2-128, rc2-cbc
rc2-128 Legacyp23M7j59Qn+e1KoNAtgQuW4OBtsGuOZx99mLhg3ckwivFbqatlDn7SYam7SSluSgrc2, rc2-cbc
rc2-40 LegacyxpPU2XVvYsOWGdtT6IaI3fYxuvi1k8hE491FiEJ4cqPDOyji2rZm/KW0TP23a40zrc2-40-cbc
rc2-40-cbc LegacyxpPU2XVvYsOWGdtT6IaI3fYxuvi1k8hE491FiEJ4cqPDOyji2rZm/KW0TP23a40zrc2-40
rc2-64 LegacyGMH0GJjoTKzKdw6yko5HNRNwQ6xpc7CU0FNw6wThsIJsOhDijjkY2GMDNvAhZtEwrc2-64-cbc
rc2-64-cbc LegacyGMH0GJjoTKzKdw6yko5HNRNwQ6xpc7CU0FNw6wThsIJsOhDijjkY2GMDNvAhZtEwrc2-64
rc2-cbc Legacyp23M7j59Qn+e1KoNAtgQuW4OBtsGuOZx99mLhg3ckwivFbqatlDn7SYam7SSluSgrc2, rc2-128
rc2-cfb LegacykDTW1hVWIKr2JKort9g+HR6Jl/urjTOwG/2HTwCUzAT2kJ2Ufwx+4lSFNw==
rc2-ecb Legacyp23M7j59Qn9hqu/aNa4p90oI8UaToXowTAdiZl+efrgBCO9kl2Za/+GtD4rwQQzU
rc2-ofb LegacykDTW1hVWIKqH2XLBBcPCfXQC9t/2wl9ZZXRcG3xuLCUEahe8qL3eoeBeig==
rc4 LegacyKx7g6UroSjBDWBIi8m/39cMAeJrjapwioV/VB4OQyQyJ2H9EJIktBznZ8Q==rc4-hmac-md5
rc4-40 LegacyPs3HuCX6QlITAORUiXB5cMUNzAD5MWLUtcuA+RNMSOlFscgZPN56KMMTAQ==
rc4-hmac-md5 LegacyKx7g6UroSjBDWBIi8m/39cMAeJrjapwioV/VB4OQyQyJ2H9EJIktBznZ8Q==rc4
rc5-cbc b0Y75AkCYLUjsca/h8U/zTxswBXuXVVjTtwSzRpjQYzWOrTgZm3mOaxPrZBurSxlrc5
rc5-cfb rSJjpziyD1WhV34ys+834YzpfKE+2XH1nkDaBoMtD0JnkOE2cKtfIeLdlA==
rc5-ecb Legacyb0Y75AkCYLWBXdDbTOwK+Ks902etwmkO0mQ2CmBnbgpaKoZu1nwJfU8zPhzp+vII
rc5-ofb rSJjpziyD1U6G8uysBbPI54nNg61sQQ0scizwxesez0Gu7ZcLFk8qI5iqQ==
Test values

rc5-ecb 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.

Textrc5-ecb (Base64)
empty stringw49DbSzScbA=
aNhCpg4NghQo=
hello worldy+QNp6qO33Le6ph1jHY5Mg==
0123456789abcdefhLOFRhxiOQz+xyQ9edd6mcOPQ20s0nGw
The quick brown fox jumps over the lazy dogb0Y75AkCYLWBXdDbTOwK+Ks902etwmkO0mQ2CmBnbgpaKoZu1nwJfU8zPhzp+vII
FAQ

Questions about rc5-ecb

Can rc5-ecb 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 rc5-ecb 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.

Is rc5-ecb safe to use?

Not for real data. ECB encrypts equal blocks to equal output, so patterns in the data stay visible. Use it only to match an existing system.

Is RC5 secure?

RC5 is outdated. It is not broken in everyday use, but its 8-byte blocks make it unsafe for large amounts of data (Sweet32) and modern ciphers like AES are better. Use it only for compatibility.

How long should my secret be?

At least 16 bytes, the default key length; longer secrets are used in full. For real security a random key is better than a typed word.

Good to know

Before you rely on it

Searches the list of pages on this site. What you type stays in your browser.