diff options
author | Keith Isdale <keith.isdale@nokia.com> | 2010-07-26 14:56:53 +1000 |
---|---|---|
committer | Keith Isdale <keith.isdale@nokia.com> | 2010-07-26 14:56:53 +1000 |
commit | 9f034793bcfc51c2b7c1dd14db806f7258f9a9eb (patch) | |
tree | 63bd0f50ce5b77828ad8205eafd7b9412810499e /botan/wrappers/swig/doit.py | |
parent | 619d92cfef29e653bfdf852e83888e50cfc4348f (diff) | |
parent | 65271649dbc90f3af1184ad1b23bdb64c0c07d07 (diff) |
Merge branch 'master' of git://git-nokia.trolltech.com.au/qtsoftware/research/qtuitest
Diffstat (limited to 'botan/wrappers/swig/doit.py')
-rw-r--r-- | botan/wrappers/swig/doit.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/botan/wrappers/swig/doit.py b/botan/wrappers/swig/doit.py new file mode 100644 index 0000000..a84623e --- /dev/null +++ b/botan/wrappers/swig/doit.py @@ -0,0 +1,49 @@ +#!/usr/bin/python2 + +import botan + +def hash_it(hash, input): + f1 = botan.Filter("MD5") + f2 = botan.Filter("Hex_Encoder") + pipe = botan.Pipe(f1, f2) + + pipe.start_msg() + pipe.write_string(input) + pipe.end_msg() + + print pipe.remaining() + + out = pipe.read(0) + + + + +def main: + init = botan.LibraryInitializer + + print hash_it("MD5", "foo") + + + key1 = botan.SymmetricKey("ABCD") + print key1.as_string() + key2 = botan.SymmetricKey(16) + print key2.as_string() + + iv1 = botan.InitializationVector(8) + print iv1.as_string() + + + f3 = pipe.read(pipe.remaining()) + + size = pipe.remaining() + out = botan.byte_array(size) + pipe.read(out.cast,size) + + for i in range (0,size): + print "%02X" % out[i] + + print pipe.read_all_as_string() + +if __name__ == "__main__": + sys.exit(main()) + |