diff --git a/aes.py b/aes.py index cb33da2..c61fd0e 100755 --- a/aes.py +++ b/aes.py @@ -4,6 +4,7 @@ import os, popen2 class Cipher: + '''Cipher represents a particular hashing strategy (password, seed, and type). Cipher can encrypt or decrypt data.''' def __init__(self, password, seed='aes.py', hashtype='rmd160'): self.password = password self.seed = seed @@ -14,12 +15,13 @@ class Cipher: return decrypt_data(encrypted, self.password, self.seed, self.hashtype) def _check_aespipe(): + '''This function checks if we have the "aespipe" binary in $PATH''' result = os.system('which aespipe > /dev/null') if result != 0: raise Exception, "Could not find aespipe; is it installed?" def encrypt_data(data, password, seed='aes.py', hashtype='rmd160'): - '''uses password to encrypt data''' + '''Uses password to encrypt data''' _check_aespipe() cmd = "aespipe -S '%s' -H '%s' -p 0" % (seed, hashtype) (stdout, stdin, stderr) = popen2.popen3(cmd) @@ -33,14 +35,14 @@ def encrypt_data(data, password, seed='aes.py', hashtype='rmd160'): return encrypted def encrypt_path(path, data, password, seed='aes.py', hashtype='rmd160'): - '''uses password to encrypt data and writes result to path''' + '''Uses password to encrypt data and writes result to path''' encrypted = encrypt_data(data, password, seed, hashtype) f = open(path, 'w') f.write(encrypted) f.close() def decrypt_data(encrypted, password, seed='aes.py', hashtype='rmd160'): - '''uses password to decrypt data''' + '''Uses password to decrypt data''' _check_aespipe() cmd = "aespipe -d -S '%s' -H '%s' -p 0" % (seed, hashtype) (stdout, stdin, stderr) = popen2.popen3(cmd) @@ -62,7 +64,7 @@ def decrypt_data(encrypted, password, seed='aes.py', hashtype='rmd160'): return data[:i] def decrypt_path(path, password, seed='aes.py', hashtype='rmd160'): - '''uses password to decrypt data from path''' + '''Uses password to decrypt data from path''' f = open(path, 'r') encrypted = f.read() f.close() diff --git a/buffer.py b/buffer.py index 547b77c..3491a5f 100644 --- a/buffer.py +++ b/buffer.py @@ -3,9 +3,9 @@ import aes, dirutil, regex, highlight from point import Point # undo/redo stack constants -ACT_NORM = 0 -ACT_UNDO = 1 -ACT_REDO = 2 +ACT_NORM = 0 +ACT_UNDO = 1 +ACT_REDO = 2 STACK_LIMIT = 1024 # used for undo/redo stacks when text will need to be added back