<p>This seems to be a variation of <a href="https://en.wikipedia.org/wiki/Three-pass_protocol" rel="nofollow noreferrer">Shamir's 3-pass protocol</a>.</p>

<p>I guess that the card trick requires commutative encryption to work, meaning that encrypting with a key <em>K_1</em> and then with another key <em>K_2</em> will produce the same result as encrypting with <em>K_2</em> and then <em>K_1</em>.</p>

<p>Most public-key encryption algorithms do NOT have this feature (at least, RSA and Elgamal do not).</p>

CC BY-SA 3.0
2017-10-15T18:15:49.043Z
2017-10-15T18:15:49.043Z
Charles Bouillaguet
<blockquote>
  <p>Three players, Bob, Alice and Ted are seated at a poker-table and are 
  playing a game of Texas Hold’em. Bob is the dealer, and he generates a deck of 52 cards on his machine, only he can view the cards. Using Fisher-Yates /dev/urandom he shuffles the deck of cards, and then encrypts the deck with the same encryption key on each card, making the deck unreadable to anyone but himself. He then passes the now encrypted deck to Alice, who does the same thing: shuffles the deck of cards and then encrypts them. Finally, Alice passes the deck to Ted who goes through the same process.  
  The deck is now in its final ordered state, 1 through 52, and this order does not change throughout the course of the hand. Ted passes the now 3x encrypted deck of cards back to Bob, who takes off his “shuffle lock” and now encrypts each individual card with a different encryption key: B1, B2….B52. He passes the deck to Alice, who does the same thing: removes her “shuffle-key” and encrypts the deck with a unique encryption key A1, A2….A52. Alice then passes the deck back to Ted, who completes this same process.</p>
</blockquote>

<p>How is it possible that Bob can remove his encryption key of a string that is completely random for him, because Alice and Ted encrypted it?</p>

<p>Is this a feature of asymetric cryptography? If so a jsfiddle or so mayb be nice :)</p>

<p>I understand that you can encrypt something with a private key and decrypt it with a public key, but is it like that that this also works on strings that somebody else also encrypted (like in the example above)? So can I just simply remove my encryption?</p>

CC BY-SA 3.0
2017-10-07T00:14:06.710Z
This seems to be a question for https://crypto.stackexchange.com/
Pieter Wuille
CC BY-SA 3.0
2018-03-18T23:57:20.053Z
I'm voting to close this question as off-topic because it has nothing to do with Bitcoin.
Nate Eldredge
<cryptography>
Cryptographic problem - locks
Ini
# Cryptographic problem - locks

(Asked by: username_0 on 2017-10-06)

> Three players, Bob, Alice and Ted are seated at a poker-table and are 
> playing a game of Texas Hold’em. Bob is the dealer, and he generates a deck of 52 cards on his machine, only he can view the cards. Using Fisher-Yates /dev/urandom he shuffles the deck of cards, and then encrypts the deck with the same encryption key on each card, making the deck unreadable to anyone but himself. He then passes the now encrypted deck to Alice, who does the same thing: shuffles the deck of cards and then encrypts them. Finally, Alice passes the deck to Ted who goes through the same process.  
> The deck is now in its final ordered state, 1 through 52, and this order does not change throughout the course of the hand. Ted passes the now 3x encrypted deck of cards back to Bob, who takes off his “shuffle lock” and now encrypts each individual card with a different encryption key: B1, B2….B52. He passes the deck to Alice, who does the same thing: removes her “shuffle-key” and encrypts the deck with a unique encryption key A1, A2….A52. Alice then passes the deck back to Ted, who completes this same process.

How is it possible that Bob can remove his encryption key of a string that is completely random for him, because Alice and Ted encrypted it?

Is this a feature of asymetric cryptography? If so a jsfiddle or so mayb be nice :)

I understand that you can encrypt something with a private key and decrypt it with a public key, but is it like that that this also works on strings that somebody else also encrypted (like in the example above)? So can I just simply remove my encryption?

**Tags:** cryptography

> **Comments:**
> **username_1**: This seems to be a question for https://crypto.stackexchange.com/  
> **username_2**: I'm voting to close this question as off-topic because it has nothing to do with Bitcoin.  

---

## 1 answers

### Answer by username_3 on 2017-10-15. Score: 1

This seems to be a variation of [Shamir's 3-pass protocol](https://en.wikipedia.org/wiki/Three-pass_protocol).

I guess that the card trick requires commutative encryption to work, meaning that encrypting with a key *K\_1* and then with another key *K\_2* will produce the same result as encrypting with *K\_2* and then *K\_1*.

Most public-key encryption algorithms do NOT have this feature (at least, RSA and Elgamal do not).


---

