From 6c5e302e7466cc73f16187db93d19cb684405484 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 31 Aug 2006 17:48:08 +0000 Subject: Also export the name() and clear() methods of the block cipher --- misc/python/src/block.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'misc/python') 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) -- cgit v1.2.3