(Optional) The rotor module implements a simple encryption algorithm, shown in Example 2-42, which is based on the WWII Enigma engine.
Example 2-42. Using the rotor Module
File: rotor-example-1.py import rotor SECRET_KEY = "spam" MESSAGE = "the holy grail" r = rotor.newrotor(SECRET_KEY) encoded_message = r.encrypt(MESSAGE) decoded_message = r.decrypt(encoded_message) print "original:", repr(MESSAGE) print "encoded message:", repr(encoded_message) print "decoded message:", repr(decoded_message) original: 'the holy grail' encoded message: '227271244 15305sw3340337252237340U' decoded message: 'the holy grail'
Core Modules
More Standard Modules
Threads and Processes
Data Representation
File Formats
Mail and News Message Processing
Network Protocols
Internationalization
Multimedia Modules
Data Storage
Tools and Utilities
Platform-Specific Modules
Implementation Support Modules
Other Modules