Ed Miller: Cryptography and PokerThink Of Your Poker Game Like You're Sending A Secret Message |
|
Every poker player should learn a bit about cryptography. Because, in a way, playing poker is actually a form of cryptography. Let me explain.
Cryptography is the science of encoding information. Typically encryption is used to encode communications between two parties so that a third party is unable to understand it. For millennia, people have been trying to encrypt their communications—and the field of cryptography has become increasingly important over the years.
All of the innovation in cryptography is designed to address one problem. There is an inherent tradeoff between ease-of-use of a cryptographic method and its security.
Interestingly, if you are interested only in security—making sure that no one can possibly break your code—and not at all in ease-of-use, then the solution to perfect encryption is trivially simple. You can use a method called a one time pad.
Let’s say we have a message written in English that is 140 characters long. We want to encode this message so that only its intended recipient can read it. Before we send the message, we generate a list of 140 random numbers from 0 to 26. Maybe we have a computer generate this list. We write the random numbers down on a piece of paper and hand it to our intended recipient.
Then we compose the message. And for every character in our message, we add the corresponding number to it—adding meaning that we go that many letters forward in the alphabet to get the new letter. So if our letter is E, and the random number is 3, then in our encrypted message we use H, because H is three letters after E.
As a matter of details, let’s say the space character comes after Z, and if our number requires us to go beyond space, we wrap around to A and start from there.
So here’s how it works in practice. I generate a random list of 140 numbers, write them on a piece of paper, and give them to my friend. He then flies anywhere in the world. At some later time, I compose a 140 character message I’d like him to read. I transform each character in my message according to the numbers in our agreed upon code. Then I send my encoded message in any format I like—perhaps a publicly-readable place like Twitter. My friend then receives the garbled message, subtracts the appropriate number from each character, and reads what I have to say.
This, believe it or not, is perfect encryption. There is no way for a third party to make heads or tails of this message. This is because every single piece of the message is randomized independently. There is no pattern between any of the 140 characters in my message, because each is transformed by an independently generated random number.
Now let’s say I have another message to send to my friend, but he is still halfway across the world. I have no way to get him a new piece of paper with new random numbers, so I just use the ones we already have agreed upon to encode the new message.
Uh oh. The encryption is no longer perfect. Why? Because now there is a pattern. Anyone watching the garbled messages on Twitter could assume that the same transformation applied to message A was also applied to message B. And from this assumption, the person might be able to discern a bit of a pattern and figure things out from there.
To understand this, assume we got really lazy, and started sending hundreds of messages to each other on Twitter, all encoded with this same 140 random numbers. Now the sorts of patterns you might see are fairly obvious. Maybe the first letter is Q in a lot of the message. Perhaps you could assume this Q is a substitute for the letter A—so maybe that first random number is 16. Does this guess of 16 make sense for other messages where the first letter isn’t Q? Is the letter I also common, which would correspond to T? And so forth.
This is the tradeoff. If you use the random numbers once, it’s perfect security. But if you get lazy—that is you want ease-of-use—then it becomes possible to find patterns in the information and crack the code entirely.
There is history of militaries using one time pads to encode communications. They would distribute paper books of randomly generated codes, and every time a message was sent, the recipient would tear out a sheet of code from the book, use it to decrypt the communique, and then use that code sheet later as toilet paper.
In any case, the entire field of cryptography is devoted to devising algorithms that allow you to reuse codes (ease-of-use) while also making the encoded messages contain as little decipherable information as possible (security).
Cryptography And Poker
Ok. So what does this have to do with poker? Well, in poker you have almost the same tradeoff. You are trying to do two things at once. First, you’re trying to put the most money in with your best hands. But you are, at the same time, trying to hide as much information as possible as you can about the strength of your hand.
Just like in cryptography, it’s actually trivial to be perfectly secure—that is, to provide no information whatsoever to your opponents about what you have. You just play randomly. At every action, you just pick a random number, and you take whatever action the random number suggests you take. This strategy is also somewhat flexible, because you can choose beforehand whether you want to be betting 20 percent of the time or 50 percent or 80 percent. Whatever strategy you choose, as long as each action is determined by a separately generated random number, you’re perfectly unreadable.
Of course if you play this way, you’ll also end up perfectly broke. Why? Because you’ll be putting in too much money with bad hands and not enough money with good hands.
But too many small stakes players go too far the other way. They’re so concerned about making sure they put in money with good hands and no money with bad hands that the patterns in their play contain enormous amounts of decipherable information. Good poker players are code-breakers—figuring out in real time the patterns of information and decoding them to infer the hidden cards.
Ideal poker play seeks to strike a happy balance. You want to put money in with good hands and not with bad hands—but you also want just the right amount of randomness to it at all times to make deciphering the patterns extremely difficult.
It will never be absolutely perfect. You can’t hide everything. But if you think of your poker game like sending a secret message, you might gain a helpful insight or two.
To learn more about cryptography, I recommend The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography by Simon Singh. ♠
Ed’s newest book, The Course: Serious Hold ‘Em Strategy For Smart Players is available now at his website edmillerpoker.com. You can also find original articles and instructional videos by Ed at the training site redchippoker.com.