Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 20
Image: ubuntu2004
# PlainText will have 0-25 # Key will take 0-25 # based off of https://en.wikipedia.org/wiki/File:Vigen%C3%A8re_square_shading.svg def VigenereEnc(PlainText,Key): PlainText = PlainText.upper() Key = Key.upper() outstr = "" for i in xrange(len(PlainText)): plainc = PlainText[i] keyc = Key[i%(len(Key))] plainnum = ord(plainc)-65 keynum = ord(keyc)-65 outstr += chr((plainnum+keynum)%26+65) print outstr
VigenereEnc("Test","Test")
MIKM
# PlainText will have 0-25 # Key will take 0-25 # based off of https://en.wikipedia.org/wiki/File:Vigen%C3%A8re_square_shading.svg def VigenereDec(CipherText,Key): CipherText = CipherText.upper() Key = Key.upper() outstr = "" for i in xrange(len(CipherText)): cipherc = CipherText[i] keyc = Key[i%(len(Key))] ciphernum = ord(cipherc)-65 keynum = ord(keyc)-65 outstr += chr((ciphernum-keynum)%26+65) print outstr
VigenereDec("MiKm","test")
TEST
gcd(1800,751)
1
a=12345 b=332 c=49 d=-1822
a*c+b*d
1