
ChaCha20-Poly1305 encrypt
Encrypt a file with ChaCha20-Poly1305 under a password, on your device.
ChaCha20-Poly1305 encrypt stretches your password into a key with PBKDF2-HMAC-SHA256 at 210,000 iterations, the same setting AES-GCM encrypt here uses. A fresh 16-byte salt and a fresh 12-byte nonce are drawn each run and stored ahead of the ciphertext, and the file is named by adding .chacha20p1305. There is no way to recover a forgotten password, since nothing about it is kept.
Questions
How is the key derived?
PBKDF2-HMAC-SHA256 over your password at 210,000 iterations, the same iteration count AES-GCM encrypt uses, with a fresh random 16-byte salt each run.
What is stored in the output file?
The 16-byte salt, then the 12-byte nonce, then the ciphertext, one after another, with .chacha20p1305 added to the file name.
Can I recover a forgotten password?
No. Nothing about the password is kept anywhere, so a forgotten password makes the file permanently unreadable.
How is this different from AES-GCM encrypt?
The cipher and authentication algorithm differ, ChaCha20-Poly1305 instead of AES-GCM, but the password-derivation setup, iteration count, salt and nonce handling, follows the same pattern.
Can I use this from the command line?
Yes, encryption needs no browser API, so it runs the same on the page, the CLI and MCP.