There is a cipher with a built-in retrospect. Each letter corresponds to its position in the alphabet:

A = 0, B = 1, C = 2, …, X = 23, Y = 24, Z = 25

The sum of two letters is derived from the sum of their corresponding positions modulo 26 (the number of letters in the alphabet). At this position in the alphabet we find the letter that is the sum of the two letters. For example, \[ \text{W} (22) + \text{Y} (24) =  \text{U} (20 = 22 + 24\!\!\!\!\mod{26}) \]

Analogously, the difference of two letters is derived from the difference of their corresponding positions modulo 26. At this position in the alphabet we find the letter that is the difference of the two letters. For example, \[ \text{F} (5) - \text{T} (19) =  \text{M} (12 = 5 - 19\!\!\!\!\mod{26}) \]

Each letter of a message is then encoded as the sum of that letter and the previous letter in the message. No distinction is made between uppercase and lowercase letters when determining the sum, but encoding replaces uppercase letters with uppercase letters and lowercase letters with lowercase letters. The first letter of the message has no previous letter, and just remains unchanged. All characters from the message that are not letters also remain unchanged.

Decoding a ciphertext simply reverses the previous process. Each letter of the ciphertext is replaced by the difference of that letter and the previous letter from the original message (which has already been decoded).

Assignment

Example

>>> encode_letter('H')
'H'
>>> encode_letter('e', 'H')
'l'
>>> encode_letter('W', 'y')
'U'

>>> decode_letter('H')
'H'
>>> decode_letter('l', 'H')
'e'
>>> decode_letter('U', 'p')
'F'

>>> encode('Henry Walton Jones Jr.')
'Hlrep Uwlehb Wxbrw Ba.'

>>> decode('Hlrep Uwlehb Wxbrw Ba.')
'Henry Walton Jones Jr.'

Epilogue

In 2012, the admissions department at the University of Chicago received a package addressed to Indiana Jones — or to Henry Walton Jones Jr., Indiana's full name. The university posted on its Tumblr page1:

The package contained an incredibly detailed replica of "University of Chicago Professor", Abner Ravenwood2's journal from Indiana Jones and the Raiders of the Lost Ark3.

It included photos, maps, and even handwritten text in which Ravenwood warns:

I was able to speak through an interpreter with the Guardian of Ark who told me that no other man beside himself could lay eyes on the Ark, that it was an absolutely holy object, and that the world would not pollute it by looking at it. He and the villagers would protect the Ark with their lives if necessary.

Undergraduate outreach Garrett Brinker told Wired4:

This package was a little perplexing because we couldn’t find the staff member or the professor [it was intended for] in the directory.

The university set up an email tip line and inquired with Lucasfilm, which only responded:

We were just as surprised to see this package as you were!

It turned out that the the replica was one of several that had been shipped from Guam to Italy. It had somehow fallen out of the package in Honolulu, and the post office had delivered it faithfully to the address it bore.

We believe that the post office wrote on our Zip code on the outside of the package and, believing the Egyptian postage was real, sent it our way. From Guam to Hawaii en route to Italy with a stopover in Chicago: truly an adventure befitting Indiana Jones.

In exchange for some University of Chicago merchandise, the original "prop replicator" in Guam agreed to let the school keep the journal5 — it's now on display in the main lobby of the Oriental Institute there.

Inspired by this story, we test all solutions submitted for this assignment with some famous Indiana Jones quotes.