Cryptography & Architecture•6 min read•

How Does a Password Generator Work? Cryptographic Architecture Guide

Technical deep-dive into client-side password generation, Web Crypto API CSPRNG, modulo bias rejection sampling, and k-anonymity protocols.

Client-Side Zero-Knowledge Architecture

The primary security foundation of any password generator is where the credentials are generated. Traditional web applications generate passwords on a backend server and transmit them across the network to the browser. This architectural design introduces two severe vulnerabilities:

  1. In-Transit Eavesdropping: Even over encrypted TLS channels, corporate decryption proxies and edge appliances can intercept plaintext payloads.
  2. Server-Side Telemetry & Persistence: Logs, caching layers, or unauthorized server operators might compromise stored credentials.

UK Bilişim Password Generator is engineered with a strict Client-Side Zero-Knowledge Architecture. All cryptographic operations execute locally on your physical device using your browser's V8/SpiderMonkey engine. Once loaded, the application functions seamlessly even if you disconnect from the internet entirely. No credentials, tokens, or hashes are ever transmitted to our servers or saved to storage.


Why Math.random() Is Insecure (PRNG vs CSPRNG)

Standard JavaScript Math.random() implements a non-cryptographic Pseudo-Random Number Generator (PRNG), typically xorshift128+ in modern browsers. While computationally fast for games and simulations, it is fundamentally deterministic:

  • An attacker observing a sequence of PRNG outputs can reconstruct the internal state of the generator.
  • Once the seed/state is compromised, past and future passwords generated by the algorithm can be predicted with 100% accuracy.

Consequently, cryptographic engineering standards (NIST, OWASP) explicitly ban Math.random() for key and credential synthesis.


Hardware Entropy: window.crypto.getRandomValues

Our engine interfaces with the standard Web Cryptography API (crypto.getRandomValues), directly leveraging the underlying operating system's cryptographic kernel (Linux/macOS /dev/urandom or Windows CNG BCryptGenRandom).

The kernel aggregates true physical non-deterministic entropy from CPU clock jitter, electronic thermal noise, network packet timings, and peripheral hardware interrupts. The resulting stream constitutes a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) with optimal information-theoretic entropy.


Eliminating Modulo Bias via Rejection Sampling

A standard implementation flaw in naive password scripts is arithmetic remainder indexing:

// INSECURE MODULO BIAS:
const index = cryptoRandomNumber % poolLength;

A 32-bit unsigned integer produces values between 00 and 232−12^{32}-1. Unless the pool size divides 2322^{32} cleanly, the lower indices receive an unfair statistical preference. This skew is known as Modulo Bias.

We eliminate modulo bias entirely using Rejection Sampling:

const maxValid = 0x100000000 - (0x100000000 % max);
let rand: number;
do {
  window.crypto.getRandomValues(uint32Buffer);
  rand = uint32Buffer[0];
} while (rand >= maxValid);
return rand % max;

Any candidate value falling within the truncated remainder zone is rejected and resampled, mathematically guaranteeing a perfectly uniform distribution across every symbol in the charset.


Fisher-Yates Uniform Permutation

When enforcing mandatory character rules ("at least one uppercase, number, symbol"), characters are initially placed into deterministic slot ranges. To prevent position-based statistical profiling, the resulting array is shuffled using a CSPRNG-backed Fisher-Yates (Knuth) Algorithm, granting each of the N!N! permutations an identical probability.


k-Anonymity Breach Verification Protocol

Our Pwned Checker verifies credential exposure against Have I Been Pwned utilizing the mathematical k-Anonymity privacy model:

  1. The 40-character SHA-1 cryptographic hash of your password is computed strictly inside your browser.
  2. Only the first 5 characters (e.g. 21BD1) are sent to the HIBP range query endpoint.
  3. The API responds with the dictionary of all matching hash suffixes.
  4. Your browser matches the remaining 35 characters locally in memory.

Neither your password nor its complete hash ever touches the network.

Generate Strong Credentials Instantly

Hardware-backed Web Crypto API with zero logging and zero server contact.

Open Password Generator →