r/coldcard•
Quantris

A python script I threw together for using a deck of cards in seed generation

See https://gist.github.com/Quantris/9143112266dacdd86f1221095e792928

I recently got a Coldcard mk3, and was interested in using the "dice rolls" feature to add entropy during seed generation. Inputting dice rolls is definitely a good fit for the Coldcard keypad.

However, I didn't particularly want to actually do all that rolling.

I've got a deck of cards that I shuffle absentmindedly pretty often, and thought it would be a good substitute. Compared to dice rolling, a neat advantage is that it's easy to shuffle a bit here and there, building up to a point where you're thoroughly shuffled. Of course the downside is, you need a computer to convert it to dice rolls for easy input in to the Coldcard.

If you do use this script, please run it offline. And I strongly suggest to use it to *add* entropy when creating a new Coldcard seed with its RNG, rather than using *only* dice rolls.

Posted Feb 27, 2020, 7:20 AM UTC

10
maltokyo•

Cool. How does it work?

1
QuantrisOP•

The basic idea is, you take the shuffled order of cards and convert that into a number ("rank") which represents which of the 52! possible orders that one is.

And then you write that number in base-6 to get a bunch of dice rolls.

There's more details about deciding how many dice rolls to extract etc. which I've left out here; I tried to explain it in the code comments but you'd need to be able to understand Python for it to really make sense. tl;dr I felt extracting 80 dice rolls was a good choice for 52 cards and definitely enough for what I was using it for.

I found this handy for creating diceware passphrases also.

1