aboutsummaryrefslogtreecommitdiffstats
path: root/misc/python/test.py
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-23 05:51:31 +0000
committerlloyd <[email protected]>2006-08-23 05:51:31 +0000
commitdec0804ab37ef874b1f7888164025e1c8c0d71cc (patch)
treec820825b3dd6e8dc30aee6e133fa885f406e5abd /misc/python/test.py
parent6b688d86c95da868dfe600c9d39485a4fafda0f8 (diff)
Support for MAC filters
Stream ciphers no longer require choosing a direction.
Diffstat (limited to 'misc/python/test.py')
-rwxr-xr-xmisc/python/test.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/misc/python/test.py b/misc/python/test.py
index 24c7f6eab..1aff5894f 100755
--- a/misc/python/test.py
+++ b/misc/python/test.py
@@ -2,13 +2,9 @@
import sys, botan
-def do_hash(input):
- cipher_key = botan.SymmetricKey("AABB")
-
- pipe = botan.Pipe(botan.Filter("Blowfish/CBC/PKCS7",
- key = botan.SymmetricKey("AABB"),
- iv = botan.InitializationVector("AABBCCDDEEFF0011"),
- dir = botan.cipher_dir.encryption),
+def encrypt(input):
+ pipe = botan.Pipe(botan.Filter("ARC4",
+ key = botan.SymmetricKey("AABB")),
botan.Filter("Hex_Encoder"))
pipe.start_msg()
@@ -17,8 +13,22 @@ def do_hash(input):
return pipe.read_all_as_string()
+def decrypt(input):
+ pipe = botan.Pipe(botan.Filter("Hex_Decoder"),
+
+ botan.Filter("ARC4",
+ key = botan.SymmetricKey("AABB")))
+
+ pipe.start_msg()
+ pipe.write(input)
+ pipe.end_msg()
+
+ return pipe.read_all_as_string()
+
def main():
- print do_hash("hi chappy")
+ ciphertext = encrypt("hi chappy")
+ print ciphertext
+ print decrypt(ciphertext)
if __name__ == "__main__":
sys.exit(main())