# How would you name and/or describe this algorithm?

First up: this is not a decoding request or anything. This is about .

Twice per year, we email another department to ask for a new licence file for their software. They are always slow to reply. The licence files are encrypted, but I noticed only a couple of characters change between revisions. My 'home-grown crypto' sense tingled. I surmised the characters that changed might correspond to the expiry date in the plaintext.

Ciphertext:

GO9ETBBE
GO9ETCBE
GO9WTBBE


Plaintext:

20150101
20150601
20160101


You can see it's not a substitution cipher. However a particular character at a particular position is always mapped the same way. For example, '1' at the third position is always mapped to '9'.

I amused myself by reverse engineering the rest of the algorithm (Python code):

letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "
secrets = "C3H8NJ1AX5VRU 2F04KYDIS6PQMOG9TLB7EWZ"

def decrypt(ciphertext):
plaintext = ""

for i,x in enumerate(ciphertext):
j = secrets.index(x)
j -= i # offset moves backwards 1 each character
j %= len(secrets)
plaintext += letters[j]

return plaintext

def encrypt(plaintext):
ciphertext = ""

for i,x in enumerate(plaintext):
j = letters.index(x)
j += i
j %= len(secrets)
ciphertext += secrets[j]

return ciphertext


Anyway, my questions are:

1. Is there a name for the "a particular character at a particular position is always mapped the same way" assumption?
2. How would you describe the algorithm? Colloquially I'd call it a "substitution cipher with a rolling offset"
• seems to me like a many time pad Feb 20 '16 at 15:33