Skip to content

Instantly share code, notes, and snippets.

View themaddoctor's full-sized avatar

themaddoctor

  • Earth (possibly)
View GitHub Profile
@themaddoctor
themaddoctor / doubleaffine.py
Created April 10, 2020 18:33
double affine encryptor
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def encrypt(p,k):
a = k[0]
b = k[1]
if len(p)%2 == 1:
p += "X"
c = ""
for i in range(len(p)//2):
value = ALPHABET.index(p[2*i])*26 + ALPHABET.index(p[2*i+1])