Commits

Cédric Bonhomme committed 7dce60a

what the points of plugs?

  • Participants
  • Parent commits 43e6c96

Comments (0)

Files changed (3)

pyenigma/cypher_enigma_safe.py

         exit()
     raw = sys.stdin.read(-1)
 
-    ct = 0
-    a = None
-    b = None
-    plugs = []
-    for c in plugs:
-        if not c.isalpha():
-            continue
-        if ct == 0:
-            a = c.upper()
-            ct = 1
-        else:
-            b = c.upper()
-            ct =0
-            plugs.append((a,b))
-
     rotors = { \
           "I":ROTOR_I,"II":ROTOR_II,"III":ROTOR_III,"IV":ROTOR_IV, \
           "V":ROTOR_V,"VI":ROTOR_VI,"VII":ROTOR_VII \
           "C":ROTOR_Reflector_C \
           }
 
-    engr = Enigma(reflectors[ref], rotors[r1], rotors[r2], \
-            rotors[r3], key, plugs)
+    engr = Enigma(reflectors[ref], rotors[r1], rotors[r2], rotors[r3], key)
     res = engr.encipher(raw)
     print(res)

pyenigma/enigma.py

         alpha_out = [" "] * 26
         for i in range(len(alpha)):
             alpha_out[i] = alpha[i]
-        for k,v in plugs:
-            alpha_out[ord(k)-ord('A')] = v
-            alpha_out[ord(v)-ord('A')] = k
 
         try:
             self.transtab = str.maketrans(alpha, "".join(alpha_out))
         'Programming Language :: Python :: 3.2',
         'Programming Language :: Python :: 3.3',
     ),
-)
+)