Want an open-source, fair, automatic and/or handmade way to have a seed phrase?

Don't rely on whatever a chip in some hardware wallet does.

Rely on your own shuffling of cards, or the entropy of lavalamps in order to shuffle and deliver fair entropy.

https://allesvoorbitcoin.be/toolsguides/seedphrasepoker/

(github project is in the footer)

Reply to this note

Please Login to reply.

Discussion

Overview

Entropy Seed Phrase Poker generates cryptographically secure seed phrases using a card-drawing game powered by high-quality randomness. It combines two decks (blue and orange) to map card pairs to words from the BIP-39 wordlist, ensuring robust entropy for secure seed phrases (11 or 23 words).

Randomness Source

The system primarily uses LavaRand, which fetches randomness from Cloudflare's drand (distributed randomness) service, pulling 173 rounds of 32-byte randomness for high entropy. If drand fails, it falls back to crypto.getRandomValues, a cryptographically secure pseudo-random number generator in modern browsers, ensuring uninterrupted operation.

Rejection Sampling

To ensure unbiased random numbers, the system employs rejection sampling in the getRandomInt function. It discards random bytes that would bias the result (e.g., for a max value of 10, it rejects bytes ≥ 250 to avoid modulo bias), guaranteeing uniform distribution for card selection and word mapping.

Shuffling Algorithm

The decks are shuffled using the Fisher-Yates (Knuth) shuffle, an unbiased algorithm that rearranges cards randomly. Each shuffle uses LavaRand or fallback randomness to determine swap indices, ensuring every permutation is equally likely. Two instances of decks are maintained, with pre-shuffling to optimize performance.

Card-to-Word Mapping

The blue deck (32 cards: 8 ranks × 4 suits) and orange deck (64 cards: 13 ranks × 4 suits + 12 "X" cards) produce 2048 possible pairs (32 × 64). Each pair is mapped to a BIP-39 word (2048 words) via a modulo operation: pairIndex = blueIndex * 64 + orangeIndex, then wordIndex = pairIndex % 2048. This ensures each draw selects a word uniformly.

Entropy Calculation

Each BIP-39 word represents 11 bits of entropy (log₂(2048) = 11). For an 11-word seed, the total entropy is 121 bits; for 23 words, it’s 253 bits. The entropy is displayed as wordCount * log₂(2048), rounded to the nearest integer, reflecting the cryptographic strength of the seed phrase.

Checksum and Security

The Calculate Checksum feature validates seed phrases by computing a SHA-256 hash of the word indices’ binary representation, using the first few bits as a checksum (per BIP-39). The system wipes sensitive data (seed phrase, randomness buffer) from memory when requested, enhancing security.

Technical Notes

The application runs over HTTPS to protect data in transit. Users are warned if accessed over HTTP (except localhost). The UI supports light/dark modes, and the code is open-source on GitHub for transparency and verification. For best practice you can download (control-s) save as... the html page to run it locally. Or use the manual version of this page that relies on physical card shuffles you can perform yourself.