This module provides utilities for encrypting and decrypting data. It is mostly used for saving passwords and other sensitive data in config files. The code in this file uses a fairly simple string transformation algorithm combined with a random salt for the encryption/decryption, and I also threw in a little code obfustication just for fun ;-).
USAGE:
EXAMPLE:
>>> salt = os.urandom(8)
>>> passwd = "HelloWorld"
>>> encrypted_passwd = Encrypt(passwd, salt)
>>> print encrypted_passwd
eNoNysERADAIArCVUAFx/8XauzyTqTEtdKEXoQIWCbCZjaM74qhPlhK4f+BVPKTTyQP7JQ5i
>>> decrypted_passwd = Decrypt(passwd, salt)
>>> print decrypted_passwd
HelloWorld
Finally: This message will self destruct in 5 seconds ...
Summary: Cryptographic routines for encrypting/decrypting text
Decrypt | Decrypt the given password string using the supplied salt as a key |
Encrypt | Encrypt the given password string using the supplied salt as the |
Decrypt the given password string using the supplied salt as a key If either the passwd or salt strings are empty the return value will be the same as the passwd parameter.
Parameters: |
|
---|
Encrypt the given password string using the supplied salt as the cryptographic key. If either the passwd or salt strings are empty the return value will be the same as the passwd parameter.
Parameters: |
|
---|