Using a Passphrase to Securely Derive Encryption Keys

The security of every encrypted message produced by this tool ultimately depends on one thing: the strength of the passphrase you choose. Because AES-256 itself is extremely secure, attackers will almost always target the passphrase rather than trying to break the cipher directly. The tool uses PBKDF2 to transform your human-readable passphrase into a fixed-length, high-entropy 256-bit key that AES can use.

PBKDF2 stands for Password-Based Key Derivation Function 2. It repeatedly applies a cryptographic hash function—SHA-256 in this case—many thousands of times. Each round makes guessing slightly more expensive for an attacker. The utility runs 100,000 iterations, a value high enough to slow down brute-force attempts significantly while still allowing quick key derivation on modern phones and laptops.

Random Salt Prevents Precomputation

Every time you encrypt a new message, the tool generates a fresh 16-byte random salt. This salt is mixed into the PBKDF2 process and then stored alongside the ciphertext. Even if two people encrypt the exact same text with the exact same passphrase, the derived keys will be completely different because of the unique salt. This defeats rainbow table attacks and forces attackers to start from scratch for every single encrypted message they want to target.

Passphrase Length Beats Complexity

Research consistently shows that longer passphrases are far more secure than short, complex passwords full of symbols. A twelve-word diceware phrase or a twenty-character random string provides vastly more entropy than an eight-character password that mixes uppercase, numbers, and special characters. The tool enforces a minimum of eight characters as a basic sanity check, but the real protection comes from choosing something substantially longer and unique.

Avoid reusing passphrases across different contexts. If the same passphrase protects multiple encrypted notes, a compromise of one note puts all of them at risk. Treat each important message as deserving its own dedicated passphrase.

Because key derivation happens entirely in the browser, you never expose your passphrase to any network. Combine this with good habits—such as using a reputable password manager to generate and store long passphrases—and the overall system becomes very difficult to attack in practice.

Subsequent posts will cover initialization vectors, large-text performance, and recognizing decryption errors so you can use the tool effectively and safely.