From 5eccc857d96d6cf1e0e77cf8685b9b414137c1d9 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 17 Jun 2015 05:29:39 +0300 Subject: cxx: add block parsing --- cxx/include/aesnixx/data.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'cxx/include') diff --git a/cxx/include/aesnixx/data.hpp b/cxx/include/aesnixx/data.hpp index 9eec56c..7a67b27 100644 --- a/cxx/include/aesnixx/data.hpp +++ b/cxx/include/aesnixx/data.hpp @@ -69,6 +69,36 @@ namespace aesni return std::string(str.str); } + void from_string(Block128& dest, const char* src) + { + aesni_parse_block128(&dest, src, ErrorDetailsThrowsInDestructor()); + } + + void from_string(Block192& dest, const char* src) + { + aesni_parse_block192(&dest, src, ErrorDetailsThrowsInDestructor()); + } + + void from_string(Block256& dest, const char* src) + { + aesni_parse_block256(&dest, src, ErrorDetailsThrowsInDestructor()); + } + + void from_string(Block128& dest, const std::string& src) + { + return from_string(dest, src.c_str()); + } + + void from_string(Block192& dest, const std::string& src) + { + return from_string(dest, src.c_str()); + } + + void from_string(Block256& dest, const std::string& src) + { + return from_string(dest, src.c_str()); + } + std::string to_matrix_string(const Block128& block) { AesNI_BlockMatrixString128 str; -- cgit v1.2.3