aboutsummaryrefslogtreecommitdiffstats
path: root/misc/python/test.py
diff options
context:
space:
mode:
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())