RSS Amplifier

John D. Cook Consulting Substack · Jul 28, 2026

Hiding cryptographic keys in decks of cards

0
Sign in to vote or save

John Cook · John D. Cook Consulting Substack

I ran across an article that showed how to store a 128-bit key in the permutations of a deck of 52 cards. I then wrote three blog posts riffing on this idea.

First of all, you can store up to 225 bits of data in the permutations of a deck of cards. This post shows how to do that, converting a huge number to a permutation and vice verse, using Python.

Given a deck size n, you can easily find how many bits of data can be stored in its permutations. But what if you want to go the other way around: given a number of bits, how big does the deck need to be?

I wrote two posts on this question. The first looks at various cryptographic key sizes and how big a deck would need to be. For example, you’d need 58 cards to store a Bitcoin key.

The second looks at an algorithm at the heart of this question. Given a number of bits b, we’re tyring to find the smallest value of n such that n! > 2b. More generally, we’re trying to invert the (log) gamma function. I wrote about how to do this a couple years ago, but the latest point gives some improvements to to previous code.

No posts

Read the original on johndcookconsulting.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.