Clicks can supply fresh entropy. A PRNG is the deterministic component that expands a fixed-size seed. A sound browser construction separates those two layers:
A static HTML/JavaScript page can perform all of this locally. The defensible result is a hybrid CSPRNG. The claim that it is more random than an ideal 256-bit machine-generated value is mathematically incorrect, since an ideal 256-bit value already has the maximum possible 256 bits of entropy.
For each of 16 targets, record an ordered sample such as
where:
-
$t_i$ is the quantized elapsed time between displaying the target and receivingpointerdown. -
$(\Delta x_i,\Delta y_i)$ are the quantized offsets between the click and target center. - The target number, target location, viewport dimensions and pointer type are included as public context.
The target location should be treated as known to an attacker. Its purpose is to elicit motor variation. It does not itself contribute human entropy.
Use a deterministic, public target sequence when measuring the human entropy source. Randomizing the targets with crypto.getRandomValues() is also reasonable, though that randomness belongs to the machine source and should be counted separately.
After the 16 clicks:
- Canonically encode every sample using fixed-width integers.
- Hash the complete ordered transcript with SHA-256.
- Obtain 32 fresh bytes from
crypto.getRandomValues()after click collection. - XOR the two 32-byte values.
- Use the result as the key for HMAC-SHA-256 with a monotonically increasing counter, or seed a reviewed DRBG construction.
The browser-facing machine generator should be crypto.getRandomValues(). The Web Crypto specification requires cryptographically strong bytes, recommends well-established CSPRNGs seeded from operating-system entropy, and explicitly supplies no information-theoretic lower bound for actual implementations. Math.random() is only approximately uniform and uses an implementation-defined strategy, so it is the wrong comparator for cryptographic randomness. (W3C)
A compact version of the seed construction is:
async function makeHybridSeed(clickTranscriptBytes) {
if (!(clickTranscriptBytes instanceof Uint8Array)) {
throw new TypeError("Expected a Uint8Array");
}
// Condition the entire click transcript.
const clickDigest = new Uint8Array(
await crypto.subtle.digest("SHA-256", clickTranscriptBytes)
);
// Draw this after click collection to simplify the independence model.
const osRandom = crypto.getRandomValues(new Uint8Array(32));
const seed = new Uint8Array(32);
for (let i = 0; i < 32; i++) {
seed[i] = osRandom[i] ^ clickDigest[i];
}
// Best-effort cleanup of temporary byte arrays.
osRandom.fill(0);
clickDigest.fill(0);
return seed;
}The transcript should use something like:
version || sampleCount ||
reactionTimeMicroseconds[0] || dxFixedPoint[0] || dyFixedPoint[0] ||
reactionTimeMicroseconds[1] || dxFixedPoint[1] || dyFixedPoint[1] ||
...
Use fixed-width big-endian integers. Avoid summing, averaging, multiplying or taking only the low timestamp bits. Those operations tend to preserve bias and discard information.
For deterministic expansion:
where value % n, which can introduce modulo bias.
A 12-word phrase consumes 16 generator bytes as 128 bits of BIP-39 entropy. A
24-word phrase consumes 32 bytes as 256 bits of entropy. For each phrase,
BIP-39 appends the first ENT / 32 bits of SHA256(entropy), splits the result
into 11-bit indexes, and maps those indexes through the standard English
2048-word list.
English is used because the BIP-39 specification identifies it as the wordlist supported by the majority of BIP-39 wallets. Each phrase consumes the next bytes from the continuous HMAC stream.
During import, a wallet converts the mnemonic and optional BIP-39 passphrase into a 512-bit seed, then applies its own BIP-32 or related derivation paths. The derivation path determines the accounts and addresses shown by that wallet.
For each generated phrase, the app derives two public previews using an empty BIP-39 passphrase:
- Bitcoin mainnet P2WPKH at
m/84'/0'/0'/0/0, the first receiving address in account zero under BIP-84. - Ethereum at
m/44'/60'/0'/0/0, the first address in account zero using the registered Ethereum coin type.
Each address row corresponds to the phrase on the same row. Address derivation consumes no additional HMAC output. A different BIP-39 passphrase or derivation path produces different addresses.
Bitcoin and Ethereum EOA keys consume 32-byte generator candidates. Interpret
each candidate as a big-endian integer 1 <= d < n, where
For Bitcoin mainnet P2WPKH, derive the compressed secp256k1 public key, compute
RIPEMD160(SHA256(publicKey)), and encode the version-zero witness program with
Bech32. Export the private key as compressed WIF using
0x80 || privateKey || 0x01 and Base58Check.
For an Ethereum EOA, derive the uncompressed secp256k1 public key, remove its
0x04 prefix, hash the remaining 64 bytes with Keccak-256, and take the final
20 bytes as the address. Display the address with the ERC-55 checksum.
The generated chain keys are independent counter-stream outputs. They are not a BIP-32 hierarchy and each private key requires its own backup.
Let:
-
$C$ be the click transcript. -
$D=H(C)$ be any deterministic 256-bit function of it. -
$R$ be an independent, perfectly uniform 256-bit machine value. -
$S=R\oplus D$ .
For every possible 256-bit output
Therefore
This proves three useful properties:
- The click source cannot degrade an independent perfect machine source.
- The result cannot become more uniform than the machine source, since exact uniformity is already the mathematical optimum.
- The clicks can provide failure resilience when the machine generator malfunctions in a way that remains independent of the clicks.
A related result applies when
Random independent XOR acts as a statistical channel and cannot increase that distance.
The independence condition matters. An adversarial source that sees
The number of timestamp digits or possible coordinates gives only an upper bound. Cryptographic analysis normally uses min-entropy:
Suppose that, for every prior click history and all attacker knowledge
Then the complete 16-click transcript has the lower bound
For example:
- A validated bound of 2 bits per click gives at least 32 bits.
- A validated bound of 4 bits per click gives at least 64 bits.
- A validated bound of 8 bits per click gives at least 128 bits.
Those are hypothetical entropy rates. They cannot be inferred from 16 clicks. They require a large validation dataset, an explicit attacker model, conservative binning, dependence analysis and confidence bounds.
Reaction time and positional error should be estimated jointly. Adding separate entropy estimates for time,
NIST treats min-entropy as a worst-case unpredictability measure and explicitly states that a deterministic conditioning function can produce at most the entropy present in its input. Hashing a 64-bit-entropy transcript into 256 bits still leaves at most 64 bits of source entropy, even when the digest passes every statistical randomness test. (NIST SP 800-90B)
For an information-theoretic statement, consider a seeded universal hash extractor. A common form of the leftover hash lemma gives
where
For a 256-bit output whose statistical distance from uniform is at most
Solving gives
With 16 clicks, that requires almost 24 bits of proven conditional min-entropy per click. Timestamp precision alone does not establish such a bound.
For a 128-bit output within
SHA-256 is a practical cryptographic conditioner, though a mathematical extractor proof for arbitrary weak sources requires a properly selected universal hash family and an independent public extractor seed. Treating SHA-256 as an extractor introduces a cryptographic assumption.
A well-designed whack-a-mole page can support this statement:
Under the assumption that the operating-system CSPRNG output is independent of the click transcript, XORing it with a SHA-256 digest of that transcript preserves the security and uniformity of the operating-system source. If the operating-system source fails benignly, any validated unpredictability in the click source remains available as supplemental security.
It cannot support this statement without extensive entropy-source validation:
Sixteen clicks produce a provably uniform 256-bit secret.
Compared with one 256-bit call to crypto.getRandomValues(), the hybrid construction provides a stronger failure-diversity argument. It provides no greater statistical uniformity when that machine call is already ideal. Compared with one Math.random() result, the hybrid construction is substantially more suitable for security because Math.random() has no cryptographic guarantee.