the setup
- You are the Sender
- Take the set of numbers
{1,2,3,...,11,12,13}
and choose a random permutationr
of the elements. There arefactorial(13) = 13!
possible arrangements of 13 elements. - For example, say you have
r = (8, 12, 1, 7, 10, 4, 3, 6, 11, 2, 5, 13, 9)
- You also have available a standard 54-card deck (4 suits * 13 cards + 2 jokers)
the challenge
- Encode
r
into the deck of cards by choosing an ordering of the deck of cards such that it is as robust as possible against errors. - The Receiver who knows the encoding/decoding algorithm but who does not know
r
should be able to recoverr
from the deck of cards even if:- some of the deck is lost in transmission -- if this is the case, how many cards can you lose and still be able to recover
r
? - the deck is received in a different order -- if this is the case, how different can it be before Receiver is unable to decode?
- some of the deck is lost in transmission -- if this is the case, how many cards can you lose and still be able to recover
example
Here is one method which is probably not very good:
- ignore the jokers, treat aces as 1 and kings as 13
- put the suits of diamonds and hearts in the same order as
r
- put suits of clubs and spades in the reverse order of
r
- construct the deck by interleaving
diamond, clubs, hearts, spades, diamond, clubs, hearts, spade, ...
- so for our example
r
the ordering of the deck would be8D,9C,8H,9S,12D,13C,12H,13S...
the rules
- the Sender/Receiver agree on the encoding/decoding mechanism prior to Sender generating
r
(describing the encoding/decoding is what you will do in your reply) - after encoding, Sender will destroy its original copy of
r
and transmit the deck of cards to the Receiver
What are some more robust methods?
10,000 sats paid
M-card
deck (M = 54
in the example) could be lost and yet still be able to reconstruct thedata
where thedata
in the example is a number between0
andfactorial(N)
whereN = 13
. I was representing that number as a permutation of13
objects, but I suppose that part is not very important.data
as being the entropy+checksum for a bip39 seed. What I want is definitions forencode
anddecode
such that:f
andg
are not equal, butf
andg
are permutations of {1,2,3,4,...,M}.Hash({8D,9C,8H,9S,12D,13C,12H,13S...})
at the end. If one package gets lost, the reciever can loop through and try 13 different values at 13 positions - thus calculating if the hash is correct13*13
different times. That's quite doable.Hash(Hash(Hash(8D,9C),Hash(8H,9S)) ,Hash(Hash(12D,13C),Hash(12H,13S)))
E.g. if the error here occured in 13S than you would first find out that the whole hash is incorrect, than findHash(Hash(8D,9C),Hash(8H,9S))
to be correct, then locate the error inHash(Hash(12D,13C),Hash(12H,13S))
etc. and go down the tree from there. That's a method that's widely used in many protocols in computer science for transmission.better example / motivation -- cold storage of entropy
N
objects. This is what a Lehmer code does, but Lehmer codes alone do not get us all the way there from a redundancy/error-correcting standpoint.M
objects whereM > N
.M
physical objects (in the exampleM = 54
) and that such an encoding stores information about a permutation ofN
objects (in the exampleN = 13
) with some robustness against errors.