From 1b3530344c506eda30b1bacf850c15400dcb7f54 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 24 Jul 2026 12:11:51 +0200 Subject: aesxx: data.hpp -> block.hpp --- aesxx/include/aesxx/all.hpp | 2 +- aesxx/include/aesxx/block.hpp | 58 +++++++++++++++++++++++++++++++++++++++++++ aesxx/include/aesxx/box.hpp | 2 +- aesxx/include/aesxx/data.hpp | 58 ------------------------------------------- 4 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 aesxx/include/aesxx/block.hpp delete mode 100644 aesxx/include/aesxx/data.hpp diff --git a/aesxx/include/aesxx/all.hpp b/aesxx/include/aesxx/all.hpp index 95992b5..c871613 100644 --- a/aesxx/include/aesxx/all.hpp +++ b/aesxx/include/aesxx/all.hpp @@ -6,8 +6,8 @@ #pragma once #include "algorithm.hpp" +#include "block.hpp" #include "box.hpp" -#include "data.hpp" #include "debug.hpp" #include "error.hpp" #include "mode.hpp" diff --git a/aesxx/include/aesxx/block.hpp b/aesxx/include/aesxx/block.hpp new file mode 100644 index 0000000..e1379df --- /dev/null +++ b/aesxx/include/aesxx/block.hpp @@ -0,0 +1,58 @@ +// Copyright (c) 2015 Egor Tensin +// This file is part of the "AES tools" project. +// For details, see https://github.com/egor-tensin/aes-tools. +// Distributed under the MIT License. + +#pragma once + +#include "algorithm.hpp" +#include "error.hpp" + +#include + +#include +#include + +namespace aes { + +class Block { +public: + static Block parse(std::string_view src) { + return Block{src}; + } + + explicit Block(AES_Block impl) : impl{impl} {} + + Block(int hi3, int hi2, int lo1, int lo0) : impl{aes_make_block(hi3, hi2, lo1, lo0)} {} + + Block() : Block{0, 0, 0, 0} {} + + explicit Block(std::string_view src) { + aes_parse_block(&impl, src.data(), ErrorDetailsThrowsInDestructor{}); + } + + AES_Block* ptr() { + return &impl; + } + + const AES_Block* ptr() const { + return &impl; + } + + std::string to_string() const { + AES_BlockString str; + aes_format_block(&str, &impl, ErrorDetailsThrowsInDestructor{}); + return str.str; + } + + std::string to_matrix_string() const { + AES_BlockMatrixString str; + aes_format_block_as_matrix(&str, &impl, ErrorDetailsThrowsInDestructor{}); + return str.str; + } + +private: + AES_Block impl; +}; + +} // namespace aes diff --git a/aesxx/include/aesxx/box.hpp b/aesxx/include/aesxx/box.hpp index 2a9659a..e625f38 100644 --- a/aesxx/include/aesxx/box.hpp +++ b/aesxx/include/aesxx/box.hpp @@ -6,7 +6,7 @@ #pragma once #include "algorithm.hpp" -#include "data.hpp" +#include "block.hpp" #include "error.hpp" #include "mode.hpp" diff --git a/aesxx/include/aesxx/data.hpp b/aesxx/include/aesxx/data.hpp deleted file mode 100644 index e1379df..0000000 --- a/aesxx/include/aesxx/data.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2015 Egor Tensin -// This file is part of the "AES tools" project. -// For details, see https://github.com/egor-tensin/aes-tools. -// Distributed under the MIT License. - -#pragma once - -#include "algorithm.hpp" -#include "error.hpp" - -#include - -#include -#include - -namespace aes { - -class Block { -public: - static Block parse(std::string_view src) { - return Block{src}; - } - - explicit Block(AES_Block impl) : impl{impl} {} - - Block(int hi3, int hi2, int lo1, int lo0) : impl{aes_make_block(hi3, hi2, lo1, lo0)} {} - - Block() : Block{0, 0, 0, 0} {} - - explicit Block(std::string_view src) { - aes_parse_block(&impl, src.data(), ErrorDetailsThrowsInDestructor{}); - } - - AES_Block* ptr() { - return &impl; - } - - const AES_Block* ptr() const { - return &impl; - } - - std::string to_string() const { - AES_BlockString str; - aes_format_block(&str, &impl, ErrorDetailsThrowsInDestructor{}); - return str.str; - } - - std::string to_matrix_string() const { - AES_BlockMatrixString str; - aes_format_block_as_matrix(&str, &impl, ErrorDetailsThrowsInDestructor{}); - return str.str; - } - -private: - AES_Block impl; -}; - -} // namespace aes -- cgit v1.3