## Jul 16, 2008

### TipHashing

I had a great nerdy idea last night as I was filling out the dinner receipt at a restaurant for a credit card purchase. Most restaurants will give you two receipts: one that the restaurant keeps and one for your own needs. I have no interest in putting a slip of paper trash in my pocket, but have occasionally contemplated doing so to "keep the restaurant honest". If I don't keep the slip, how would I really know if they changed the tip on me before charging my card? And if they know I didn't keep the slip, they could feel pretty comfortable with changing my tip and hoping I didn't notice or care.

My new idea is checksumming my tips. First I compute the dollar amount of the total bill that I want to pay: bill + tip. I do this the normal way: 10%-20% added to the bill. Then, I use the cents portion of the bill as a checksum of the dollar portion. An easy thing to do would always be to make it the same such as \$14.14 or \$27.27, but that is also easy to spot and change by a person. Instead, I do the inverse (\$1 - X) of the dollar portion. So for a \$14 total, I would leave \$14.86 (14 + 86 = 100) or for a \$27 total, I would leave \$27.73 (27 + 73 = 100). If you want smaller numbers, you can subtract the dollars from a smaller sum, maybe 50: \$27.23 (27 + 23 = 50). Now, when I get my credit card bill, I can actually figure out if my checksum matches up. If I see a \$15.86 charge, I sum the components (15 + 86 = 101) and I can see that a dollar was added to my bill. Less likely, but possible, a penny was added to my bill - either way someone was mucking with my bill.