Passphrase Hygiene & Auto-Lock Protocol: Securing Keys in Memory

A practical guide to generating unbreakable Diceware passphrases, measuring Shannon entropy, and safeguarding unlocked sessions with automatic memory zeroization.

1. Complex Passwords vs. Diceware Passphrases

For decades, users were instructed to create passwords like Tr0ub4dor&3!. Modern research has proven this approach flawed:

The Solution is Multi-Word Passphrases: A phrase composed of 6 randomly chosen dictionary words (e.g., correct horse battery staple beacon glory) is effortlessly memorable for humans yet mathematically impossible for brute-force clusters to guess.

2. How the CSPRNG Diceware Generator Works

True cryptographic randomness cannot use Math.random(), which is a pseudo-random generator vulnerable to seed reconstruction.

ZevSafe's built-in generator exclusively queries window.crypto.getRandomValues(new Uint32Array(1)):

  1. Click the ๐ŸŽฒ icon next to the master passphrase field.
  2. The generator pulls hardware entropy from your system kernel (keystroke timing, thermal sensor noise, interrupt jitter).
  3. It selects 6 distinct words from an audited 7,776-word EFF wordlist.
  4. Each word provides exactly $\log_2(7776) \approx 12.917$ bits of entropy. A 6-word phrase delivers 77.5 bits of true entropy.

3. Measuring Shannon Entropy in Real-Time

As you type a password, ZevSafe continuously evaluates the Shannon entropy:

Information Theory ยท Shannon Entropy Formula
H(X) = - \sum_{i=1}^{n} P(x_i) \log_2 P(x_i)

Pool Entropy = L \times \log_2(N)
Where L = length of passphrase, N = character pool size

The strength meter displays both color cues and bit metrics:

4. The Inactivity Auto-Lock Protocol

When you unlock a vault in Vault Explorer, decrypted files and encryption keys reside in browser memory. If you step away from your desk, an unauthorized person could view or export your files.

ZevSafe includes a configurable Inactivity Watcher:

5. Cryptographic Memory Zeroization (.fill(0))

Simply deleting an object in JavaScript (e.g. key = null) does not guarantee that the underlying memory is cleared; the raw bytes remain in the heap until garbage collection runs.

๐Ÿ›ก๏ธ Explicit Buffer Scrubbing

ZevSafe wraps all key derivations and session teardowns in try...finally blocks with explicit .fill(0) zeroization. Before dropping references, raw password bytes, salt buffers, keyfile hashes, and mixed key material are physically overwritten with zeros!

JavaScript Architecture ยท Memory Scrubbing Invariant
function lockV3VaultSession() {
    // 1. Overwrite volatile keyfile bytes
    if (activeKeyfileBytes) {
        activeKeyfileBytes.fill(0);
        activeKeyfileBytes = null;
    }
    
    // 2. Clear and scrub chunk cache
    if (chunkCache) {
        chunkCache.clear(); // Wipes all 4MB chunk buffers
    }
    
    // 3. Nullify CryptoKey and catalog references
    currentV3Vault = null;
    
    // 4. Reset password inputs
    document.querySelectorAll('input[type="password"]').forEach(input => {
        input.value = '';
    });
}