- The password you used when you encrypted the message.
- The encrypted text produced by the app — a long Base64 block of letters, numbers, and symbols that looks like:
WPUiBcZ2b20Riq7IMDBNjgRVkgnAiKDTjOdXCpch1YNOdMmGIV4X8tfQxD1rcdOM...
Windows — PowerShell 7.4 or newer
We will use PowerShell 7.4 or newer, a free command-line tool from Microsoft. It has everything needed built in — no extra downloads beyond PowerShell itself.
Install PowerShell 7.4 or newer
The easiest way is through the Microsoft Store — it takes about two minutes:
- Click the Start button (Windows logo in the bottom-left corner).
- Open the Microsoft Store (search for it if you can't find it).
- In the search bar at the top of the Store, type PowerShell and press Enter.
- Click the result that says PowerShell with "Microsoft Corporation" listed as the publisher.
- Click Get (or Install) and wait for it to finish.
learn.microsoft.com — Installing PowerShell on Windows
Download the file ending in
-win-x64.msi and run it, clicking Next on each screen.
Open PowerShell 7.4 or newer
- Click the Start button.
- Type PowerShell 7.
- Click PowerShell 7 in the results. (It may also be listed as pwsh.)
- A dark window with a blinking cursor appears — this is your terminal. It will show something like
PS C:\Users\YourName>.
Choose how you want to decrypt
Read directly in terminal
Keep this decryption out of saved command history
Run this first. It remembers your current PSReadLine history setting, then stops new commands from being saved to its persistent history file for the rest of this PowerShell session.
$previousHistoryStyle = (Get-PSReadLineOption).HistorySaveStyle; Set-PSReadLineOption -HistorySaveStyle SaveNothing
Paste and run the decryption code
- Click Copy code.
- Paste the command into PowerShell.
- Important — do not press Enter yet.
- In the pasted command, find
TEXT TO DECRYPT. - Replace it with the complete Base64 encrypted text you want to decrypt.
- Find
PASSWORDand replace it with the password used to encrypt the message. - Keep the single quote marks around both replacements.
- Make sure both placeholders have been replaced.
- Press Enter. The decrypted message appears in PowerShell.
[byte[]]$bytes=[Convert]::FromBase64String(('TEXT TO DECRYPT' -replace '\s','')); [byte[]]$salt=$bytes[0..15]; [byte[]]$iv=$bytes[16..27]; [byte[]]$ciphertext=$bytes[28..($bytes.Length-17)]; [byte[]]$tag=$bytes[($bytes.Length-16)..($bytes.Length-1)]; $pbkdf2=[System.Security.Cryptography.Rfc2898DeriveBytes]::new([System.Text.Encoding]::UTF8.GetBytes('PASSWORD'),$salt,100000,[System.Security.Cryptography.HashAlgorithmName]::SHA256); [byte[]]$key=$pbkdf2.GetBytes(32); $pbkdf2.Dispose(); $aesGcm=[System.Security.Cryptography.AesGcm]::new($key,16); [byte[]]$plaintext=New-Object byte[] $ciphertext.Length; $aesGcm.Decrypt($iv,$ciphertext,$tag,$plaintext); $aesGcm.Dispose(); Write-Host ([System.Text.Encoding]::UTF8.GetString($plaintext))
TEXT TO DECRYPT and PASSWORD.it's ready becomes 'it''s ready'. Spaces, dollar signs, and other punctuation need no other change inside PowerShell single quotes.Clean up after reading
Run the following after you have finished reading or copying the message. It clears the variables, clears PowerShell's session history and PSReadLine's in-memory recall list, clears the clipboard, restores your earlier history setting, and clears the visible screen.
$bytes=$null; $salt=$null; $iv=$null; $ciphertext=$null; $tag=$null; $key=$null; $plaintext=$null; Clear-History; [Microsoft.PowerShell.PSConsoleReadLine]::ClearHistory(); Set-Clipboard -Value ''; Set-PSReadLineOption -HistorySaveStyle $previousHistoryStyle; $previousHistoryStyle=$null; Clear-Host
Clear-Host does not guarantee that every terminal application has discarded its scrollback. In Windows Terminal, open the command palette with Ctrl+Shift+P, run Clear Buffer, then close the tab when finished.Clear-History clears every command from the current PowerShell session history, not only the decryption command. It does not delete the persistent PSReadLine history file. The separate PSReadLine in-memory recall list is cleared before history saving is restored, so unrelated history saved before this session is preserved.Remove-Item (Get-PSReadLineOption).HistorySavePath -Force deletes ALL saved PowerShell command history, not only this decryption session.Save encrypted message to file
Save your encrypted text to a file
Copy the command below into PowerShell. Then replace everything between the two quote marks with your actual encrypted text — delete the placeholder text entirely and paste yours in its place.
"PASTE_YOUR_FULL_ENCRYPTED_TEXT_HERE" | Set-Content "$HOME\secret.txt" -Encoding utf8
Press Enter. This saves your encrypted text as a file called secret.txt in your home folder (C:\Users\YourName\).
Edit and run the decryption script
Copy the entire script below. Before you paste it into PowerShell:
- Find the line that says
'YOUR_PASSWORD_HERE' - Replace that text with your actual password — keep the single quote marks around it
Then paste the whole thing into PowerShell (right-click to paste) and press Enter.
$password = 'YOUR_PASSWORD_HERE'
$bytes = [Convert]::FromBase64String((Get-Content "$HOME\secret.txt" -Raw).Trim())
[byte[]]$salt = $bytes[0..15]
[byte[]]$iv = $bytes[16..27]
[byte[]]$ciphertext = $bytes[28..($bytes.Length - 17)]
[byte[]]$tag = $bytes[($bytes.Length - 16)..($bytes.Length - 1)]
$pbkdf2 = [System.Security.Cryptography.Rfc2898DeriveBytes]::new(
[System.Text.Encoding]::UTF8.GetBytes($password),
$salt, 100000,
[System.Security.Cryptography.HashAlgorithmName]::SHA256)
[byte[]]$key = $pbkdf2.GetBytes(32)
$pbkdf2.Dispose()
$aesGcm = [System.Security.Cryptography.AesGcm]::new([byte[]]$key)
$plaintext = New-Object byte[] $ciphertext.Length
$aesGcm.Decrypt($iv, $ciphertext, $tag, $plaintext)
$aesGcm.Dispose()
Write-Host ([System.Text.Encoding]::UTF8.GetString($plaintext))
'? Write it as two single quotes: '' inside the script. Example: if your password is it's, write 'it''s'.Password contains a dollar sign
$? Single quotes protect it — no changes needed.
See your result
After a second or two your decrypted message will appear in the terminal window. You can select and copy it just like normal text.
Troubleshooting
$password line and run the script again.Mac — Python 3
We will use Python 3 and a free helper package called cryptography. The setup takes about 5 minutes and only needs to be done once.
Open Terminal
Terminal is the command-line tool on Mac. You can find it two ways:
- Spotlight (easiest): Press ⌘ Cmd+Space, type Terminal, press Enter.
- Finder: Go to Applications → Utilities → Terminal.
A window opens with a prompt — this is your terminal. You type commands here and press Enter to run them.
Check that Python 3 is installed
Type the following and press Enter:
python3 --version
- If you see
Python 3.x.x— Python is installed. Go to Step 3. - If a popup appears asking to install developer tools — click Install and wait. Python 3 will be included.
- If you see an error — go to python.org/downloads/macos, download the latest macOS installer, and run it. Then try the command above again.
Install the cryptography package
Type this and press Enter:
pip3 install cryptography
Wait until you see a line that says Successfully installed cryptography-.... This only needs to be done once ever.
python3 -m pip install cryptography
Choose how you want to decrypt
Read directly in terminal
Start a private zsh history context
Modern macOS uses zsh by default. Run this first so the sensitive pasted command goes into a temporary history list instead of your normal saved history:
fc -p
echo $SHELL does not end in /zsh, do not use this command. See the Linux section's Bash instructions if your shell is Bash.Paste and run the decryption code
- Click Copy code.
- Paste the entire Python block into Terminal.
- Important — do not press Enter yet. Python is the multiline exception, so make sure the whole block has appeared before editing it.
- Use the arrow keys to move through the pasted block and find
TEXT TO DECRYPT. - Replace it with the complete Base64 encrypted text you want to decrypt.
- Find
PASSWORDand replace it with the password used to encrypt the message. - Keep the double quote marks around both replacements.
- Make sure both placeholders have been replaced.
- Press Enter. The decrypted message appears in Terminal.
python3 - <<'PY'
import base64
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
encrypted_bytes = base64.b64decode("".join("TEXT TO DECRYPT".split()), validate=True)
salt = encrypted_bytes[:16]
iv = encrypted_bytes[16:28]
ciphertext_and_tag = encrypted_bytes[28:]
kdf = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32, salt=salt, iterations=100000)
key = kdf.derive("PASSWORD".encode("utf-8"))
plaintext_bytes = AESGCM(key).decrypt(iv, ciphertext_and_tag, None)
print(plaintext_bytes.decode("utf-8"))
PY
TEXT TO DECRYPT and PASSWORD.\" for a double quote and \\ for a backslash. Spaces, single quotes, Swedish characters, and emoji need no change.Clean up after reading
The Python process has ended, so its password, encrypted input, key, and plaintext variables are no longer available in the shell. Run these commands individually:
pbcopy < /dev/null
fc -P
clear
pbcopy empties the macOS clipboard. fc -P discards the temporary zsh history context and restores your normal history. clear clears the visible screen.
clear does not necessarily remove earlier output from scrollback. In Apple's Terminal app, press ⌘ Cmd+K to clear scrollback, then close the tab. Other terminal apps may use a menu item named Clear Scrollback or Clear Buffer. This does not guarantee secure memory erasure.Save encrypted message to file
Save your encrypted text to a file
Type this command and press Enter:
cat > ~/secret.txt
The cursor will move to a new blank line — that means Terminal is waiting for you to type or paste something.
- Paste your encrypted text: press ⌘ Cmd+V.
- Press Enter once more to go to a new line.
- Press Ctrl+D (hold Control, tap D). This saves the file.
pbpaste > ~/secret.txtThis pastes your clipboard directly into the file in one step.
Create the decryption script
We will use nano, a simple text editor built into Mac. Type this and press Enter:
nano ~/decrypt.py
The terminal changes to show a plain text editor. Now paste the script below (⌘ Cmd+V). Before pasting, change YOUR_PASSWORD_HERE to your actual password (keep the double quote marks around it).
import base64, os
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
password = "YOUR_PASSWORD_HERE".encode("utf-8")
with open(os.path.expanduser("~/secret.txt")) as f:
data = base64.b64decode(f.read().strip())
salt, iv, ciphertext = data[:16], data[16:28], data[28:]
kdf = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32, salt=salt, iterations=100000)
key = kdf.derive(password)
plaintext = AESGCM(key).decrypt(iv, ciphertext, None)
print(plaintext.decode("utf-8"))
To save and close nano:
- Press Ctrl+X
- Press Y to confirm you want to save
- Press Enter to keep the filename
decrypt.py
"? Write it as \" inside the script. Write a backslash as \\. Spaces, Swedish characters, and emoji work as written.
Run the script
Type this and press Enter:
python3 ~/decrypt.py
Your decrypted message will appear on the next line.
Troubleshooting
nano ~/decrypt.py), check the password carefully — watch out for capital letters and extra spaces — save, and run again.pip3 install cryptographyLinux / Python — Python 3
We will use Python 3 and the free cryptography package. Python 3 is pre-installed on most Linux distributions.
Open a Terminal
How to open a terminal depends on your desktop:
- Ubuntu / GNOME: Press Ctrl+Alt+T, or search "Terminal" in the Activities overview.
- KDE Plasma: Right-click the desktop and choose Open Terminal, or press Alt+F2 and type
konsole. - Any desktop: Search for "Terminal" or "Console" in your application menu.
Check Python 3 and install if needed
Type this and press Enter:
python3 --version
If you see Python 3.x.x — skip to Step 3. If not, install it:
- Ubuntu / Debian / Linux Mint:
sudo apt update && sudo apt install python3 python3-pip
- Fedora / RHEL:
sudo dnf install python3 python3-pip
- Arch / Manjaro:
sudo pacman -S python python-pip
You will be asked for your system password — type it and press Enter. Note: the password will not appear as you type. That is normal.
Install the cryptography package
pip3 install cryptography
Wait until you see Successfully installed cryptography-.... This only needs to be done once.
pip3 install --user cryptography
Choose how you want to decrypt
Read directly in terminal
Keep this decryption out of normal shell history
First check your shell:
basename "$SHELL"
If it says bash, run:
OLD_HISTCONTROL=$HISTCONTROL; HISTCONTROL=ignorespace
The decryption code below deliberately begins with one space. Bash's ignorespace setting keeps that pasted command out of its history. Your earlier setting is restored during cleanup.
If it says zsh, run:
fc -p
This pushes an empty temporary zsh history context, which is discarded during cleanup.
Paste and run the decryption code
- Click Copy code.
- Paste the entire Python block into Terminal.
- Important — do not press Enter yet. Python is the multiline exception, so make sure the whole block has appeared before editing it.
- Use the arrow keys to move through the pasted block and find
TEXT TO DECRYPT. - Replace it with the complete Base64 encrypted text you want to decrypt.
- Find
PASSWORDand replace it with the password used to encrypt the message. - Keep the double quote marks around both replacements.
- Make sure both placeholders have been replaced.
- Press Enter. The decrypted message appears in Terminal.
python3 - <<'PY'
import base64
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
encrypted_bytes = base64.b64decode("".join("TEXT TO DECRYPT".split()), validate=True)
salt = encrypted_bytes[:16]
iv = encrypted_bytes[16:28]
ciphertext_and_tag = encrypted_bytes[28:]
kdf = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32, salt=salt, iterations=100000)
key = kdf.derive("PASSWORD".encode("utf-8"))
plaintext_bytes = AESGCM(key).decrypt(iv, ciphertext_and_tag, None)
print(plaintext_bytes.decode("utf-8"))
PY
TEXT TO DECRYPT and PASSWORD are no longer visible. If either placeholder remains, do not run the code. If you use Bash, keep the space before python3.\" for a double quote and \\ for a backslash. Spaces, single quotes, Swedish characters, and emoji need no change.Clean up after reading
The Python subprocess has ended, so its password, encrypted input, key, and plaintext variables are no longer available in the shell.
If you use Bash, run:
HISTCONTROL=$OLD_HISTCONTROL; unset OLD_HISTCONTROL; clear
If you use zsh, run:
fc -P; clear
To clear the clipboard, use the command matching your desktop:
- Wayland:
wl-copy --clear(requires the optionalwl-clipboardpackage). - X11:
printf '' | xclip -selection clipboard(requires the optionalxclippackage). - If neither command is installed, copy some harmless text or use your desktop's clipboard manager to remove the entry.
clear only clears the visible screen in many terminal applications. Use your terminal's Clear Scrollback or Clear Buffer action, then close the tab. These cleanup steps reduce exposure but do not guarantee secure memory erasure.Save encrypted message to file
Save your encrypted text to a file
Type this command and press Enter:
cat > ~/secret.txt
The cursor moves to a blank line — Terminal is waiting for input.
- Paste your encrypted text. In most Linux terminals you paste with Ctrl+Shift+V (not Ctrl+V).
- Press Enter to go to a new line.
- Press Ctrl+D to save and close.
Create the decryption script
Open the nano text editor:
nano ~/decrypt.py
Paste the script below. Change YOUR_PASSWORD_HERE to your actual password first (keep the double quote marks).
To paste in nano: Ctrl+Shift+V (or right-click if your terminal supports it).
import base64, os
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
password = "YOUR_PASSWORD_HERE".encode("utf-8")
with open(os.path.expanduser("~/secret.txt")) as f:
data = base64.b64decode(f.read().strip())
salt, iv, ciphertext = data[:16], data[16:28], data[28:]
kdf = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32, salt=salt, iterations=100000)
key = kdf.derive(password)
plaintext = AESGCM(key).decrypt(iv, ciphertext, None)
print(plaintext.decode("utf-8"))
Save and exit nano:
- Press Ctrl+X
- Press Y to confirm saving
- Press Enter to keep the filename
sudo apt install nano (Ubuntu/Debian) or sudo dnf install nano (Fedora).
"? Write it as \". Write a backslash as \\. Spaces, Swedish characters, and emoji work as written.
Run the script
python3 ~/decrypt.py
Your decrypted message will appear on the next line.
Troubleshooting
nano ~/decrypt.py, fix the password, save, and run again.pip3 install cryptography or pip3 install --user cryptographyWhy this works without the app
This tool encrypts using only open, standardised algorithms — any implementation that follows the same format will produce the same result:
| Bytes | Length | Contents |
|---|---|---|
| 0 – 15 | 16 bytes | Random salt (for PBKDF2 key derivation) |
| 16 – 27 | 12 bytes | Random IV / nonce (for AES-GCM) |
| 28 – (end−17) | variable | Ciphertext |
| last 16 | 16 bytes | GCM authentication tag |
PBKDF2-SHA256 (100,000 iterations) — open standard, defined in RFC 8018.
AES-256-GCM — NIST standard, available in .NET, Python, OpenSSL, Go, Rust, and more.