Dear Cecil:

How do the television program codes for VCR Plus+ work? VCR Plus+ is a handheld device similar to a TV remote control that tells the VCR to record a target program at a specific time, channel, and duration based on a numeric code listed in TV Guide and many newspapers. I see no pattern to these codes, which have a different meaning each month. One month "12345" may indicate a Friday night news show on channel 2, the next month something entirely different. How can this be? There must be some sort of algorithm. Any ideas?

Illustration by Slug Signorino

Cecil replies:

Yes, there is an algorithm. If we had any sense we would leave it at that. But no, I can see you want to know what the algorithm is. Maybe you’d also like to know how to perform brain surgery with a can opener. Either way we are stretching the limit of what human ingenuity can accomplish in a 600-word column. But hey, your wish is my command.

The VCR Plus+ control box, which is sold by Gemstar Development, can be set up to emulate the remote controls for your VCR and/or cable box. You punch in the number(s) for the programs(s) you want to record, put a blank tape in the VCR, and leave the VCR Plus+ box pointed at the TV. At the right time VCR Plus+ beams out the proper pulses to turn on the VCR, switch to the right channel, start recording, then shut the VCR off when the show is over. VCR Plus+ can even record shows on two different cable channels when you’re not home, something a VCR alone can’t do.

Gemstar is cagey about its business strategy, but presumably profits from VCR Plus+ in two ways: by selling the control box to you and the TV listing codes to newspapers. Since the codes are encrypted, competitors can’t bootleg the boxes and newspapers can’t figure out the codes on their own.

But Gemstar didn’t reckon with the nation’s tireless computer geniuses. Three of them, Ken Shirriff, Curt Welch, and Andrew Kinsman, got together via the Internet computer network, broke the code (most of it, anyway), and published the result in the journal *Cryptologia* last July. Somebody else used this as the basis for a VCR Plus+ encoding/decoding program called VCRPLS.ZIP that for a time was posted on computer bulletin boards and such. It seems to have become scarce of late, perhaps because VCR Plus+’s lawyers have been on the case. Here’s how it worked, based on the *Cryptologia* article:

1. Start with the code number 3316 from May, 1991. “No-carry” multiply 3316 by the magic decoding key 68150631. (No-carry multiply means to do regular multiplication except you discard all carries.) This gives us 82324978296.

2. Truncate this to the same number of digits in 3316 (four), i.e., 8296. Take the last three digits (296), subtract 1, divide the result by 32, add 1 to the quotient. This gives us the day of the month, 10.

3. Take the remaining digit (8), and … ah, it’s hopeless to explain in detail. You perform this incredibly complicated routine involving numerous sums, products, and quotients plus a double-barreled dose of modular arithmetic, squeeze the result through an if-then sieve based on the number of digits, do some more sums and products, and convert the result to binary. Take the remainder from Step 2, the month plus one times the day (that’s why the codes change each month), and the “offset” (never mind) and add them modulo 32; convert the result to binary. (REMEMBER, THIS WAS YOUR IDEA.) Rearrange certain bits from the two binary numbers previously described according to a specified formula to make a new binary number, add 1 to get the channel. Rearrange other bits from the first two binary numbers according to the aforesaid formula to get still another binary number; use this as an index to a table that gives start times and durations of shows. The result, take my word for it, is a 2 hour show on channel 4 at 9 PM on May 10, 1991.

NOTE: This only works for VCR Plus+ numbers up to six digits long. Shirriff et al. haven’t figured out the drill for the longer ones yet — are these guys are lazy or what? My advice: give up, be a consumer, and let the damn box to do it for you.

Send questions to Cecil via cecil@straightdope.com.