Encryption and steganography

Encrypt text or a file with a password and hide text in an image. Everything runs in the browser, nothing is sent to a server.

Encrypt with a password

AES-256-GCM, the key derived from the password with PBKDF2-SHA-256, 600,000 iterations. The password and data never leave the browser. A forgotten password cannot be recovered.

What to encrypt

Hide in an image

Steganography hides, it does not protect. Telegram, Instagram and others recompress images and the hidden data is lost: send the image as a file.

The text goes into the lowest bits of the colours, each channel changes by 1 out of 255. Choose an image: if something is already hidden in it, I will show it.

or drop it here

Password encryption and steganography

Text or a file is encrypted with AES-256-GCM. The 256-bit key is derived from the password with PBKDF2-SHA-256 at 600,000 iterations (the number OWASP recommends for PBKDF2-HMAC-SHA256) and a random 16-byte salt, and the 12-byte nonce is random too. The same text with the same password gives a new string every time. The 16-byte GCM tag checks integrity: with a wrong password and with a corrupted byte the same error is shown.

Steganography writes data into the least significant bit of the R, G and B channels of each pixel, so a channel's color changes by at most 1 out of 255. An image holds width × height × 3 / 8 bytes minus a 12-byte header. You can open a PNG, JPEG or WebP, and the result is saved as a lossless PNG. Everything is computed in the browser.

Examples

  • The word "Привет" (12 bytes in UTF-8) turns into 67 bytes: a 39-byte header with the salt and nonce, 12 bytes of ciphertext and a 16-byte tag. After the olerast-enc v1: prefix that is 92 Base64 characters.
  • A 1920 × 1080 image holds 777,588 bytes, and a 4000 × 3000 photo holds 4,499,988 bytes.
  • With the "Encrypt with a password first" checkbox the image gets an olerast-enc container written into it. Whoever extracts the bits will see the marker and the ciphertext, and can't read the text without the password.

Common mistakes

  • People send the encrypted text and the password in one message. Anyone with access to the conversation gets both.
  • People pick a short password. 600,000 iterations slow down each attempt, but a 6-digit password is brute-forced in a million attempts.
  • People forward an image with hidden text as a photo. The messenger recompresses it, the least significant bits change, and the CRC-32 check reports that nothing is hidden.
  • People don't save the password in a password manager and forget it. A forgotten password can't be recovered: the string holds only the salt, the nonce and the ciphertext.

FAQ

How do I pass on the encrypted text and the password?
Through different channels. Send the olerast-enc string by messenger or email, and give the password in person, by phone or through another messenger. If you agree on the password in advance, only the ciphertext goes over the network.
How is AES with a password different from Base64 and the Caesar cipher?
Base64 only changes how bytes are written, there is no key. In the Caesar cipher the key is an alphabet shift, and the Russian alphabet has 32 working shifts, which you can try by hand. A 256-bit AES-256 key can't be brute-forced, so attackers go after the password, and each attempt costs 600,000 PBKDF2 iterations.
Why does the text disappear from the image after a messenger?
Telegram and Instagram recompress an image sent as a photo, and the least significant bits of the colors change. Send the PNG as a file or document: then the bytes arrive unchanged, and the text comes back out.
Can it be decrypted without the password?
No. The key is not in the string; there is a salt and a nonce, and the key comes from them only together with the password. Only the password itself can be guessed, and the cipher is as strong as the password: check it on the "Passwords" page.

You might also need