- Posts:
- 1,874
- Group:
- Members
- Member
- #3,310
- Joined:
- December 12, 2009
|
- Code:
-
#[space]Autokey[space]poly-Playfair[space]digram[space]substitution[space]in[space]combination[space]with[space]other[space]simple #[space]classical[space]substitution[space]encryption[space]algorithms.
#[space]M.[space]K.[space]Shen,[space]31.01.2014.[space][space](mok-kong.shen@t-online.de)
#[space]Available[space]at:[space]http://s13.zetaboards.com/Crypto/topic/7153822/1/
#[space](Code[space]lines[space]of[space]the[space]same[space]date[space]are[space]always[space]identical.[space]There[space]may[space]however[space]be #[space]interim[space]modifications[space]of[space]comment[space]lines.)
#[space]Prologue.
#[space]This[space]code[space]implements[space]a[space]combination[space]of[space]several[space]well-known[space]simple[space]classical #[space](hence[space]easy[space]for[space]the[space]general[space]users[space]to[space]examine[space]and[space]verify)[space]substitution #[space]encryption[space]algorithms[space]as[space]follows,[space]the[space]selected[space]special[space]combination[space]being #[space]deemed[space]sufficiently[space]optimal[space]for[space]application[space]in[space]the[space]communications[space]of[space]the #[space]common[space]users[space]that[space]are[space]as[space]a[space]rule[space]of[space]fairly[space]low[space]volumes: # #[space]Mono-alphabetical[space]substitution. #[space]Autokey[space]Vigenere[space]substitution. #[space]Autokey[space]poly-Playfair[space]digram[space]substitution. #[space]Autokey[space]Vigenere[space]substitution. #[space]Mono-alphabetical[space]substitution.
#[space]The[space]number[space]of[space]Playfair[space]matrices[space]used[space]is[space]arbitrary,[space]so[space]that[space]this[space]can[space]be[space]chosen #[space]to[space]be[space]sufficiently[space]small[space]in[space]case[space]one[space]of[space]the[space]communication[space]partners[space]has[space]to[space]do #[space]his[space]work[space]manually.
#[space]The[space]autokey[space]Vigenere[space]substitutions[space]result[space]in[space]certain[space]chaining[space]effects[space]which #[space]could[space]also[space]highly[space]reduce[space]the[space]number[space]of[space]doublets[space]in[space]the[space]plaintext[space]characters #[space]being[space]transformed[space]by[space]Playfair[space]to[space]doublets[space]of[space]the[space]ciphertext[space]characters.[space]For #[space]some[space]discussions[space]on[space]Playfair,[space]see[space][1].
#[space]Note[space]that[space]the[space](ciphertext)[space]alphabet[space]to[space]be[space]specified[space]may[space](and[space]in[space]fact #[space]preferably)[space]be[space]larger[space]than[space](and[space]include)[space]the[space]set[space]of[space]characters[space]that[space]the #[space]plaintext[space]is[space]written[space]in.
#[space]The[space]general[space]benefits[space]of[space]combining[space]diffusion[space]and[space]confusion[space]are[space]well-known. #[space]Hence[space]it[space]is[space]always[space]profitable[space]to[space]employ[space]the[space]present[space]scheme[space]with[space]pre-[space]and/or #[space]post-processing[space]with[space]transpositions.[space]For[space]Python[space]codes[space]of[space]a[space]couple[space]of[space]simple #[space]transposition[space]schemes[space]based[space]on[space]classical[space]ideas,[space]see[space][2,3].
#[space]For[space]testing[space]the[space]statistical[space]properties[space]of[space]Python's[space]built-in[space]PRNG[space]a[space]function[space]in #[space][4][space]may[space]be[space]used.
#[space]The[space]individual[space]functions[space]employed[space]inside[space]combinedsubstitution()[space]could[space]of #[space]course[space]also[space]be[space]used[space]singly,[space]if[space]desired.
#[space]It[space]is[space]the[space]user's[space]responsibility[space]to[space]choose[space]the[space]appropriate[space]parameters[space]in #[space]calling[space]combinedsubstitution()[space]and[space]properly[space]generate[space]and[space]manage[space]his[space]secret #[space]materials.[space]A[space]convenient[space]way[space]to[space]generate[space]the[space]secret[space]materials[space]is[space]to[space]employ[space]a #[space]secret[space]phrase/sentence[space]concatenated[space]with[space]session-dependent[space]variable[space]data[space]e.g. #[space]date,[space]message[space]number,[space]etc.[space]to[space]create[space]a[space]dynamic[space]key[space]to[space]seed[space]Python's[space]built-in #[space]PRNG[space]and[space]use[space]a[space]function[space]in[space]the[space]system[space]module[space]random,[space]as[space]Example[space]5[space]further #[space]below[space]shows. # #[space][1][space]http://s13.zetaboards.com/Crypto/topic/7134291/1/ #[space][2][space]http://s13.zetaboards.com/Crypto/topic/7139297/1/ #[space][3][space]http://s13.zetaboards.com/Crypto/topic/7145746/1/ #[space][4][space]http://s13.zetaboards.com/Crypto/topic/7115671/1/[space]
import[space]random
#[space]The[space]playfair[space]matrices[space]have[space]n[space]rows[space]and[space]m[space]columns[space]with[space]the[space]characters[space]row-wise #[space]concatenated[space]given[space]as[space]strings[space]in[space]the[space]list[space]matlist.[space]matlist[space]may[space]be[space]specified[space]by #[space]the[space]user[space]directly[space]or[space]pseudo-randomly[space]generated[space]with[space]genmatlist().[space]Let[space]g[space]be[space]the #[space]number[space]of[space]matrices[space](1[space]<=[space]g[space]<=[space](size[space]of[space]alphabet)**2)[space]to[space]be[space]employed.[space]Initially #[space]the[space]indices[space]of[space]characters[space]of[space]primingkey[space]in[space]the[space]alphabet[space](mod[space]g)[space]are[space]used[space]to #[space]select[space]the[space]matrices[space]to[space]be[space]used.[space]Thereafter[space]we[space]use[space]the[space]indices[space]in[space]the[space]alphabet #[space]of[space]pairs[space]of[space]characters[space]to[space]obtain[space]an[space]integer[space]in[space]the[space]range #[space][0,(size[space]of[space]alphabet)**2-1][space]and[space]taken[space]modulo[space]g[space]to[space]select[space]the[space]next[space]matrix[space]to #[space]be[space]employed.[space]We[space]use[space]for[space]this[space]purpose: #[space]pairs[space]of[space]plaintext[space]characters,[space]if[space]ktp=0 #[space]pairs[space]of[space]ciphertext[space]characters,[space]if[space]ktp=1. #[space]On[space]encryption,[space]processing[space]begins[space]with[space]the[space]start-th[space]character[space]of[space]the[space]plaintext, #[space]with[space]wrapping[space]around[space]to[space]the[space]beginning[space](1[space]<=[space]start[space]<=[space]length[space]of[space]textstr).[space]This #[space]is[space]mainly[space]useful[space]for[space]employing[space]e.g.[space]two[space]rounds[space]of[space]the[space]present[space]function[space]in #[space]sequence,[space]with[space]start=1[space]for[space]the[space]first[space]round[space]and[space]start=2[space]for[space]the[space]2nd[space]round,[space]thus #[space]resulting[space](due[space]to[space]overlapping[space]of[space]pairs[space]of[space]characters[space]of[space]the[space]two[space]rounds)[space]in #[space]some[space]effect[space]of[space]multi-gram[space]transformations. #[space]Encryption:[space]textstr[space]is[space]plaintext,[space]kn=0. #[space]Decryption:[space]textstr[space]is[space]ciphertext,[space]kn=1. #[space]Characters[space]of[space]textstr[space]must[space]be[space]in[space]alphabet. #[space]Note[space]that[space]alphabet[space]may[space]be[space](preferably)[space]a[space]randomly[space]ordered[space]one[space]and[space]kept[space]secret. #[space]Length[space]of[space]textstr[space]must[space]be[space]a[space]even. [space] def[space]autokeyplayfair(alphabet,n,m,matlist,primingkey,textstr,start,ktp,kn): [space][space]assert(n>=2[space]and[space]m>=2[space]and[space]0<=ktp<=1[space]and[space]0<=kn<=1)[space][space] [space][space]lalpha=len(alphabet) [space][space]assert(lalpha==n*m) [space][space]for[space]u[space]in[space]alphabet: [space][space][space][space]assert(alphabet.count(u)==1) [space][space]g=len(matlist) [space][space]assert(0<g<2*lalpha) [space][space]for[space]i[space]in[space]range(g): [space][space][space][space]assert(len(matlist[i])==lalpha) [space][space][space][space]for[space]u[space]in[space]matlist[i]: [space][space][space][space][space][space]assert(u[space]in[space]alphabet[space]and[space]matlist[i].count(u)==1) [space][space]klist=[alphabet.index(u)%g[space]for[space]u[space]in[space]primingkey] [space][space]assert(len(klist)>0) [space][space]ltext=len(textstr) [space][space]assert((ltext%2)==0[space]and[space]1<=start<=ltext) [space][space]for[space]u[space]in[space]textstr: [space][space][space][space]assert(u[space]in[space]alphabet) [space][space]indices=[(i,j)[space]for[space]i[space]in[space]range(n)[space]for[space]j[space]in[space]range(m)] [space][space]ki=0 [space][space]str="" [space][space]start-=1 [space][space]if[space]kn==0: [space][space][space][space]textstr=textstr[start:]+textstr[:start] [space][space][space][space]for[space]h[space]in[space]range(0,ltext,2): [space][space][space][space][space][space]kk=klist[ki] [space][space][space][space][space][space]ki+=1 [space][space][space][space][space][space]a=textstr[h] [space][space][space][space][space][space]b=textstr[h+1] [space][space][space][space][space][space]i1,j1=indices[matlist[kk].index(a)] [space][space][space][space][space][space]i2,j2=indices[matlist[kk].index(b)] [space][space][space][space][space][space]if[space]j1==j2: [space][space][space][space][space][space][space][space]i1=(i1+1)%n [space][space][space][space][space][space][space][space]i2=(i2+1)%n [space][space][space][space][space][space]elif[space]i1==i2: [space][space][space][space][space][space][space][space]j1=(j1+1)%m [space][space][space][space][space][space][space][space]j2=(j2+1)%m [space][space][space][space][space][space]else:[space] [space][space][space][space][space][space][space][space]j1,j2=j2,j1 [space][space][space][space][space][space]c=matlist[kk][i1*m+j1] [space][space][space][space][space][space]d=matlist[kk][i2*m+j2] [space][space][space][space][space][space]str+=c+d [space][space][space][space][space][space]if[space]ktp==0: [space][space][space][space][space][space][space][space]klist.append((alphabet.index(a)*lalpha+alphabet.index(b))%g) [space][space][space][space][space][space]else: [space][space][space][space][space][space][space][space]klist.append((alphabet.index(c)*lalpha+alphabet.index(d))%g) [space][space]else: [space][space][space][space]for[space]h[space]in[space]range(0,ltext,2): [space][space][space][space][space][space]kk=klist[ki] [space][space][space][space][space][space]ki+=1 [space][space][space][space][space][space]a=textstr[h] [space][space][space][space][space][space]b=textstr[h+1] [space][space][space][space][space][space]i1,j1=indices[matlist[kk].index(a)] [space][space][space][space][space][space]i2,j2=indices[matlist[kk].index(b)] [space][space][space][space][space][space]if[space]j1==j2: [space][space][space][space][space][space][space][space]i1=(i1-1)%n [space][space][space][space][space][space][space][space]i2=(i2-1)%n [space][space][space][space][space][space]elif[space]i1==i2: [space][space][space][space][space][space][space][space]j1=(j1-1)%m [space][space][space][space][space][space][space][space]j2=(j2-1)%m [space][space][space][space][space][space]else:[space] [space][space][space][space][space][space][space][space]j1,j2=j2,j1 [space][space][space][space][space][space]c=matlist[kk][i1*m+j1] [space][space][space][space][space][space]d=matlist[kk][i2*m+j2] [space][space][space][space][space][space]str+=c+d [space][space][space][space][space][space]if[space]ktp==0: [space][space][space][space][space][space][space][space]klist.append((alphabet.index(c)*lalpha+alphabet.index(d))%g) [space][space][space][space][space][space]else: [space][space][space][space][space][space][space][space]klist.append((alphabet.index(a)*lalpha+alphabet.index(b))%g) [space][space][space][space]start=ltext-start [space][space][space][space]str=str[start:]+str[:start] [space][space]return(str)
#[space]Generate[space]a[space]matlist[space]containing[space]g[space]lists[space]with[space]Python's[space]built-in[space]PRNG[space]seeded[space]with #[space](secret)[space]seed,[space]which[space]is[space]preferably[space]dynamically[space]varying,[space]being[space]e.g.[space]the #[space]concatenation[space]of[space]a[space]secret[space]phrase[space]with[space]the[space]date,[space]message[space]number[space]etc.[space]for[space]the #[space]different[space]communication[space]sessions.
def[space]genmatlist(alphabet,n,m,seed,g): [space][space]random.seed(seed) [space][space]lalpha=len(alphabet) [space][space]assert(lalpha==n*m) [space][space]for[space]u[space]in[space]alphabet: [space][space][space][space]assert(alphabet.count(u)==1) [space][space]h=list(alphabet)[space][space] [space][space]matlist=[] [space][space]for[space]i[space]in[space]range(g): [space][space][space][space]random.shuffle(h) [space][space][space][space]matlist.append(h[:]) [space][space]return(matlist)[space]
#[space]Draw[space]the[space]matrices[space]specified[space]in[space]matlist.
def[space]drawmatrices(n,m,matlist): [space][space]cc=(2*m+1)*"-" [space][space]g=len(matlist) [space][space]for[space]h[space]in[space]range(g): [space][space][space][space]print(cc) [space][space][space][space]for[space]i[space]in[space]range(n): [space][space][space][space][space][space]s="|" [space][space][space][space][space][space]k=i*m [space][space][space][space][space][space]for[space]j[space]in[space]range(m): [space][space][space][space][space][space][space][space]s+=matlist[h][k+j]+"|" [space][space][space][space][space][space]print(s) [space][space][space][space]print(cc)
#[space]kn=0:[space]Encryption.[space]Characters[space]in[space]alphabet[space]in[space]textstr[space]are[space]replaced[space]by[space]those[space]in #[space]monoalphabet. #[space]kn=1:[space]Decryption.
def[space]monosub(alphabet,monoalphabet,textstr,kn): [space][space]assert(0<=kn<=1) [space][space]lalpha=len(alphabet) [space][space]lmonoalpha=len(monoalphabet) [space][space]assert(lalpha==lmonoalpha) [space][space]for[space]u[space]in[space]alphabet: [space][space][space][space]assert(alphabet.count(u)==1) [space][space]for[space]u[space]in[space]monoalphabet: [space][space][space][space]assert(monoalphabet.count(u)==1) [space][space]ltext=len(textstr) [space][space]for[space]u[space]in[space]textstr: [space][space][space][space]assert(u[space]in[space]alphabet) [space][space]str="" [space][space]if[space]kn==0: [space][space][space][space]for[space]u[space]in[space]textstr: [space][space][space][space][space][space][space]str+=monoalphabet[alphabet.index(u)] [space][space]else: [space][space][space][space]for[space]u[space]in[space]textstr: [space][space][space][space][space][space][space]str+=alphabet[monoalphabet.index(u)] [space][space]return(str)
#[space]sn=0:[space]Processing[space]direction[space]left[space]to[space]right. #[space]sn=1:[space]Processing[space]direction[space]right[space]to[space]left. #[space]kind=0:[space]After[space]exhaustion[space]of[space]initialkey[space]use[space]plaintext[space]characters. #[space]kind=1:[space]After[space]exhaustion[space]of[space]initialkey[space]use[space]ciphertext[space]characters. #[space]Characters[space]of[space]textstr[space]must[space]be[space]in[space]alphabet. #[space]Note[space]that[space]alphabet[space]may[space]be[space](preferably)[space]a[space]randomly[space]ordered[space]one[space]and[space]kept[space]secret. #[space]kn=0:[space]Encryption. #[space]kn=1:[space]Decryption.
def[space]autokeyvigenere(sn,kind,alphabet,initialkey,textstr,kn): [space][space]assert(0<=sn<=1[space]and[space]0<=kind<=1[space]and[space]0<=kn<=1) [space][space]lalpha=len(alphabet) [space][space]for[space]u[space]in[space]alphabet: [space][space][space][space]assert(alphabet.count(u)==1) [space][space]lkey=len(initialkey) [space][space]assert(lkey>0) [space][space]for[space]u[space]in[space]initialkey: [space][space][space][space]assert(u[space]in[space]alphabet) [space][space]ltext=len(textstr) [space][space]for[space]u[space]in[space]textstr: [space][space][space][space]assert(u[space]in[space]alphabet) [space][space]str="" [space][space]g=[alphabet.index(initialkey[i])[space]for[space]i[space]in[space]range(lkey)] [space][space]if[space]sn==0: [space][space][space][space]r1,r2,r3=0,ltext,1 [space][space]else: [space][space][space][space]r1,r2,r3=ltext-1,-1,-1 [space][space]k=0 [space][space]for[space]i[space]in[space]range(r1,r2,r3): [space][space][space][space]pii=alphabet.index(textstr[i]) [space][space][space][space]s=g[k] [space][space][space][space]if[space]kn==0: [space][space][space][space][space][space]cii=(pii+s)%lalpha [space][space][space][space]else: [space][space][space][space][space][space]cii=(pii-s)%lalpha [space][space][space][space]if[space]kind==0: [space][space][space][space][space][space]g.append(pii[space]if[space]kn==0[space]else[space]cii) [space][space][space][space]else: [space][space][space][space][space][space]g.append(cii[space]if[space]kn==0[space]else[space]pii) [space][space][space][space]str+=alphabet[cii] [space][space][space][space]k+=1 [space][space]if[space]sn==0: [space][space][space][space]return(str) [space][space]else: [space][space][space][space]strr="" [space][space][space][space]for[space]k[space]in[space]range(r1,r2,r3): [space][space][space][space][space][space]strr+=str[k] [space][space][space][space]return(strr)
#[space]kn=0:[space]Encryption. #[space]kn=1:[space]Decryption. #[space]Characters[space]of[space]textstr[space]must[space]be[space]in[space]alphabet. #[space]Note[space]that[space]alphabet[space]may[space]be[space](preferably)[space]a[space]randomly[space]ordered[space]one[space]and[space]kept[space]secret. #[space]Length[space]of[space]textstr[space]must[space]be[space]even. #[space]For[space]meaning[space]and[space]constraints[space]of[space]the[space]parameter[space]values[space]see[space]the[space]comments[space]to[space]the #[space]respective[space]functions[space]being[space]called[space]inside[space]this[space]function. #[space]Only[space]a[space]single[space]round[space]of[space]autokeyplayfair()[space]is[space]called[space]inside[space]this[space]function. #[space]Note[space]that[space]for[space]the[space]autokey[space]Vigenere[space]substitutions[space]in[space]this[space]function[space]we #[space]arbitrarily[space]use[space]the[space]first[space]and[space]last[space]character[space]of[space]the[space]alphabet[space]as[space]the[space]initial #[space]keys,[space]the[space]issue[space]being[space]unessential,[space]since[space]the[space]purpose[space]here[space]is[space]merely[space]to[space]achieve #[space]certain[space]chaining[space]effects.
def[space]combinedsubstitution(alphabet,monoalphabet1,monoalphabet2, [space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space]n,m,matlist,primingkey,textstr,start,ktp,kn): [space][space]lalpha=len(alphabet) [space][space]assert(len(monoalphabet1)==lalpha[space]and[space]len(monoalphabet2)==lalpha) [space][space]ltext=len(textstr) [space][space]kind=1 [space][space]if[space]kn==0: [space][space][space][space]textstr=monosub(alphabet,monoalphabet1,textstr,0) [space][space][space][space]textstr=autokeyvigenere(0,kind,alphabet,alphabet[0],textstr,0) [space][space][space][space]textstr=autokeyplayfair(alphabet,n,m,matlist,primingkey,textstr,start,ktp,0) [space][space][space][space]textstr=autokeyvigenere(1,kind,alphabet,alphabet[-1],textstr,0) [space][space][space][space]textstr=monosub(alphabet,monoalphabet2,textstr,0) [space][space]else: [space][space][space][space]textstr=monosub(alphabet,monoalphabet2,textstr,1) [space][space][space][space]textstr=autokeyvigenere(1,kind,alphabet,alphabet[-1],textstr,1) [space][space][space][space]textstr=autokeyplayfair(alphabet,n,m,matlist,primingkey,textstr,start,ktp,1) [space][space][space][space]textstr=autokeyvigenere(0,kind,alphabet,alphabet[0],textstr,1) [space][space][space][space]textstr=monosub(alphabet,monoalphabet1,textstr,1) [space][space]return(textstr)
#[space]Illustrative[space]examples:
#[space]Example[space]1,[space]testing[space]autokeyplayfair(),[space]matlist[space]is[space]given[space]by[space]the[space]user. #[space]Length[space]of[space]plaintext[space]must[space]be[space]even.
print("Example[space]1.") print() [space][space][space][space][space][space][space][space][space][space][space][space][space][space] n=4 m=3 alphabet="abcdefghijkl" primingkey="ekh" start=1 ktp=0
matlist=["cabdfegihkjl","dbkhifaejclg"]
#[space]Sender[space]side:
pt="cbaadfghkibbgkhc" ct=autokeyplayfair(alphabet,n,m,matlist,primingkey,pt,start,ktp,0)
#[space]Recipient[space]side: pt1=autokeyplayfair(alphabet,n,m,matlist,primingkey,ct,start,ktp,1)
print("pt,ct,pt1,pt==pt1:") print() print(pt,ct,pt1,pt==pt1) print()
#[space]Example[space]2,[space]testing[space]autokeyplayfair(),[space]matlist[space]is[space]automaically[space]generated #[space]and[space]matrices[space]are[space]shown.[space]Length[space]of[space]plaintext[space]must[space]be[space]even.
print("Example[space]2.") print()
n=4 m=3 alphabet="abcdefghijkl" primingkey="ekh" start=1 ktp=0
seed="adynamicsecretseedtobeputhere" matlist=genmatlist(alphabet,n,m,seed,3) print("matlist[space]generated:") print() print(matlist) print() print("The[space]corresponding[space]matrices:") drawmatrices(n,m,matlist) print()
#[space]Sender[space]side:
pt="cbaadfghkibbgkhc" ct=autokeyplayfair(alphabet,n,m,matlist,primingkey,pt,start,ktp,0)
#[space]Recipient[space]side: pt1=autokeyplayfair(alphabet,n,m,matlist,primingkey,ct,start,ktp,1)
print("pt,ct,pt1,pt==pt1:") print() print(pt,ct,pt1,pt==pt1) print()
#[space]Example[space]3,[space]testing[space]monosub().
print("Example[space]3.") print()
alphabet="abcdefghijkl" monoalphabet="cdafebgihjkl"
pt="bacdefjfffaaallibcac" ct=monosub(alphabet,monoalphabet,pt,0) pt1=monosub(alphabet,monoalphabet,ct,1)
print("pt,ct,pt1,pt==pt1:") print() print(pt,ct,pt1,pt==pt1) print()
#[space]Example[space]4,[space]testing[space]autokeyvigenere().
print("Example[space]4.") print()
initialkey="qfmut" sn=1 kind=0 alphabet="zctbuxyoremsahvikpdqlwgfjn" pt="thisismyplaintext" ct=autokeyvigenere(sn,kind,alphabet,initialkey,pt,0) pt1=autokeyvigenere(sn,kind,alphabet,initialkey,ct,1)
print("pt,ct,pt1,pt==pt1:") print() print(pt,ct,pt1,pt==pt1) print()
#[space]Example[space]5,[space]testing[space]use[space]of[space]combinedsubstitution()[space]with[space]automatic[space]generation[space]of #[space]matlist[space]and[space]monoalphabet1[space]and[space]monoalphabet2.[space](Seeding[space]of[space]PRNG[space]is[space]performed[space]in #[space]genmatlist(),[space]hence[space]generation[space]of[space]monoalphabets[space]is[space]done[space]thereafter.) #[space]Length[space]of[space]plaintext[space]is[space]even.
print("Example[space]5") print()
n=4 m=4 alphabet="fedcbaghijklDCBA" primingkey="ekh" start=1 ktp=0
seed="adynamicsecretseedtobeputhere" matlist=genmatlist(alphabet,n,m,seed,3)
alphalist=list(alphabet) g1=alphalist[:] g2=alphalist[:] random.shuffle(g1) random.shuffle(g2) monoalphabet1="".join(g1) monoalphabet2="".join(g2)
pt="bacdefjfffaaallibcac" ct=combinedsubstitution(alphabet,monoalphabet1,monoalphabet2, [space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space]n,m,matlist,primingkey,pt,start,ktp,0) pt1=combinedsubstitution(alphabet,monoalphabet1,monoalphabet2, [space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space][space]n,m,matlist,primingkey,ct,start,ktp,1)
print("pt,ct,pt1,pt==pt1:") print() print(pt,ct,pt1,pt==pt1)
|