Larry Bugbee, July 2006Rotor: WWII Enigma
Rotor is a software implementation of the German Enigma machine of WW II. Rotor was once included in the Python standard library, but was removed from Python 2.4, in large part because Rotor is not considered cryptographically strong, but Rotor can be effective for instructional and low-value encryption purposes.
Note: THIS CODE IS PROVIDED WITHOUT WARRANTY OR GUARANTEE OF ANY KIND.
USE AT YOUR OWN RISK.
import rotor mykey = 'abcd' numrotors = 12 message = 'Kilroy was here' r = rotor.newrotor(mykey, numrotors) ciphertext = r.encrypt(message) r2 = rotor.newrotor(mykey, numrotors) plaintext = r2.decrypt(ciphertext)Download: