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.





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):


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"
  • 3
    $\begingroup$ seems to me like a many time pad $\endgroup$
    – mandragore
    Feb 20 '16 at 15:33
  1. I don't think there is a name for this special kind of property, but it is a clear hint for polyalphabetic substitution ciphers.

  2. It is a special kind of polyalphabetic substitution cipher. The first alphabet is a normal random key, while each successive alphabet is generated by a one-character right shift of the previous alphabet. As a result there are as many alphabets as there are characters in the plaintext (or cipher text) alphabet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.