Credit for this problem goes to jrice, and puzzling.stackexchange.com. Thanks!

Five Card Magic Trick

At a party last night, my friends Alice and Bob did a magic trick. Any ideas how it worked?

Alice shuffled a pack of cards, and asked me to take five. I looked at them. She put the rest of the pack down on the table. Alice asked for my cards. She gave four of them to Bob (he was across the table), and the fifth back to me. Bob looked at the four cards for a while. Then Bob looked at me, and named the card I was holding. He was right. I’m quite sure he couldn’t have seen it (we weren’t sitting by a mirror).

They did the trick again later to someone else. I watched for funny business. Alice didn’t say anything to Bob, so I don’t think they have a code. Also Alice is famously clumsy, so I doubt it was sleight of hand.

Solution