diff options
author | lloyd <[email protected]> | 2006-08-31 17:43:20 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-08-31 17:43:20 +0000 |
commit | fdb896dfa9c45bada38f3d7f9472e82cc6f685f9 (patch) | |
tree | 8ff9449cde2540e1ebd6ae2c255baba13a8dea0c /misc/python/test.py | |
parent | b8844f2bfca984285f9cfe61bed56cf5d9c33705 (diff) |
Add simple wrappers for block cipher objects
Diffstat (limited to 'misc/python/test.py')
-rwxr-xr-x | misc/python/test.py | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/misc/python/test.py b/misc/python/test.py index 9896777d4..20c2a9119 100755 --- a/misc/python/test.py +++ b/misc/python/test.py @@ -2,36 +2,15 @@ import sys, botan -def encrypt(input): - cipher_key = botan.SymmetricKey("AABB") - print cipher_key.length - cipher_key = botan.SymmetricKey("AABBCCDD") - print cipher_key.length - - cipher = botan.Filter("ARC4", key = cipher_key) - - pipe = botan.Pipe(cipher, botan.Filter("Hex_Encoder")) - - pipe.start_msg() - pipe.write(input) - pipe.end_msg() - - str = pipe.read_all() - print str - return str - -def decrypt(input): - pipe = botan.Pipe(botan.Filter("Hex_Decoder"), - botan.Filter("ARC4", - key = botan.SymmetricKey("AABBCCDD"))) - - pipe.process_msg(input) - return pipe.read_all() +class PyAlgo(botan.Algorithm): + def name(self): + return "PyAlgo" + def clear(self): + print "clearing" def main(): - ciphertext = encrypt("hi chappy") - print ciphertext - print decrypt(ciphertext) + alg = PyAlgo() + botan.print_algo(alg) if __name__ == "__main__": sys.exit(main()) |