Quantum Key Security

Document type: Applied cryptography research page

Domain: Quantum-resistant coordinate derivation from natural language passphrases

Date: July 15, 2025

Quantum key security illustration

1. Abstract

The presented method deterministically derives 100 high-entropy coordinates (each 128-bit) from a natural-language passphrase, resulting in a total output width of 12,800 bits. The construction combines per-word hashing with a multi-round nonlinear mixing process.

The design is hash-agnostic and intentionally avoids dependency on memory-hardness assumptions. Security is based on very large output domain size and strong diffusion across rounds.

2. Construction overview

  • Each passphrase word is hashed independently together with optional salt.
  • Per-word digest is split into two 128-bit base values.
  • A deterministic mixing function applies rotations, XOR, shifts, and multiplicative scrambling.
  • Coordinates are distributed across words until 100 outputs are reached.

3. Quantum security position

  • Shor-based attack paths: not applicable to this non-algebraic hash-and-mix structure.
  • Grover-based search: reduces exhaustive search complexity quadratically, but domain remains extremely large.

With 12,800 output bits, the naive classical preimage scale is approximately 2^12800. Under a Grover-style model, this is reduced to about 2^6400 operations, still beyond practical attack feasibility.

4. Practical use cases

  • Quantum-resistant seed derivation from human-readable phrases.
  • Brainwallet-like deterministic key material with large coordinate lattice output.
  • High-dimensional cryptographic coordinate generation for advanced protocols.
  • Decentralized identity/key derivation schemes tied to natural-language input.

5. Code example (full reference)

use blake3::Hasher;

// Helper function: rotate
fn rotate_left_u128(value: u128, n: u32) -> u128 {
    value.rotate_left(n)
}

// Mixing function with multiple rounds, deterministic
fn mix(val1: u128, val2: u128, round: u32) -> u128 {
    let mut v = val1 ^ val2 ^ (round as u128);
    for i in 0..8 {
        let rot_bits = ((i * 7 + round * 3) % 128) as u32;
        v = v.rotate_left(rot_bits);
        v = v.wrapping_mul(0x9E3779B97F4A7C15);
        v ^= v >> 23;
        v = v.wrapping_add(round as u128);
    }
    v
}

// Generate 100 coordinates by hashing each word separately with salt,
// distributing the coordinates evenly, no zero-padding
fn derive_coordinates_per_word(keyphrase: &str, salt: &str) -> Vec<u128> {
    let words: Vec<&str> = keyphrase.split_whitespace().collect();
    let word_count = words.len();

    let base_coords_per_word = 100 / word_count;
    let remainder = 100 % word_count;

    let mut coords = Vec::with_capacity(100);

    for (idx, word) in words.iter().enumerate() {
        let coords_for_word = if idx < remainder {
            base_coords_per_word + 1
        } else {
            base_coords_per_word
        };

        // Hash salt + word
        let mut hasher = Hasher::new();
        hasher.update(salt.as_bytes());
        hasher.update(word.as_bytes());
        let hash = hasher.finalize();

        let hash_bytes = hash.as_bytes();
        let base_val1 = u128::from_be_bytes(hash_bytes[0..16].try_into().unwrap());
        let base_val2 = u128::from_be_bytes(hash_bytes[16..32].try_into().unwrap());

        for i in 0..coords_for_word {
            let rot1 = rotate_left_u128(base_val1, (i % 128) as u32);
            let rot2 = rotate_left_u128(base_val2, ((i * 3) % 128) as u32);
            let mixed_val = mix(rot1, rot2, i as u32);
            coords.push(mixed_val);
        }
    }

    coords.truncate(100);
    coords
}

// Main
fn main() {
    let keyphrase = "silver ladder dove cloud whisper apple horse river matrix zero jazz velvet canyon galaxy timber foam vivid spring echo marble giant zero rapid";
    let salt = "optional_salt";

    println!("Using keyphrase: \"{}\"", keyphrase);
    println!("Using salt: \"{}\"\n", salt);

    let coords = derive_coordinates_per_word(keyphrase, salt);

    for (i, c) in coords.iter().enumerate() {
        println!("Coordinate {:03}: {:032x}", i, c);
    }

    let lattice_dec = coords.iter().map(|c| c.to_string()).collect::<Vec<_>>().join(",");
    println!("\nLattice grid (decimal):\n{}", lattice_dec);

    let lattice_hex = coords.iter()
        .map(|c| format!("{:032x}", c))
        .collect::<Vec<_>>()
        .join(",");
    println!("\nLattice grid (hex):\n{}", lattice_hex);

    // --- Quantum security debug info ---
    let total_bits = coords.len() * 128;
    println!("\n=== Quantum Security Debug ===");
    println!("Total output bits: {} bits", total_bits);
    println!("Classical brute-force complexity: 2^{total_bits}");
    let grover_exp = total_bits / 2;
    println!("Grover's algorithm reduces this to ~2^{grover_exp} steps");
    println!("Shor's algorithm does NOT apply as no algebraic structure is exploited");
    println!("Therefore, security level is dominated by Grover resistance\n");
}

Note: this page summarizes the research direction and provides the full reference code block from the public paper version.