diff options
author | lloyd <[email protected]> | 2006-08-31 17:48:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-08-31 17:48:08 +0000 |
commit | 6c5e302e7466cc73f16187db93d19cb684405484 (patch) | |
tree | 51af089801d99f768042642b6d6661ae13a49eaf | |
parent | fdb896dfa9c45bada38f3d7f9472e82cc6f685f9 (diff) |
Also export the name() and clear() methods of the block cipher
-rw-r--r-- | misc/python/src/block.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/misc/python/src/block.cpp b/misc/python/src/block.cpp index d68300ce6..57b132e3e 100644 --- a/misc/python/src/block.cpp +++ b/misc/python/src/block.cpp @@ -39,6 +39,9 @@ class Py_BlockCipher return cipher->valid_keylength(kl); } + std::string name() const { return cipher->name(); } + void clear() throw() { cipher->clear(); } + std::string encrypt(const std::string& in) const { return process(in, cipher, &BlockCipher::encrypt); @@ -48,19 +51,13 @@ class Py_BlockCipher return process(in, cipher, &BlockCipher::decrypt); } - void set_key(const OctetString& key) - { - cipher->set_key(key); - } + void set_key(const OctetString& key) { cipher->set_key(key); } Py_BlockCipher(const std::string& name) { cipher = get_block_cipher(name); } - ~Py_BlockCipher() - { - delete cipher; - } + ~Py_BlockCipher() { delete cipher; } private: BlockCipher* cipher; }; @@ -72,6 +69,8 @@ void export_block_ciphers() .add_property("keylength_min", &Py_BlockCipher::keylength_min) .add_property("keylength_max", &Py_BlockCipher::keylength_max) .add_property("keylength_mod", &Py_BlockCipher::keylength_mod) + .add_property("name", &Py_BlockCipher::name) + .def("clear", &Py_BlockCipher::clear) .def("valid_keylength", &Py_BlockCipher::valid_keylength) .def("set_key", &Py_BlockCipher::set_key) .def("encrypt", &Py_BlockCipher::encrypt) |