diff options
| author | Egor Tensin <egor@tensin.name> | 2026-07-24 12:27:43 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-07-24 12:27:43 +0200 |
| commit | 978d47ebb09b90993f1f5c40c8010b8fdb2f6378 (patch) | |
| tree | 7b83750cd64a7616944da391a835291dd82a04e5 /aesxx/include | |
| parent | aesxx: factor out key stuff into key.hpp (diff) | |
| download | aes-tools-978d47ebb09b90993f1f5c40c8010b8fdb2f6378.tar.gz aes-tools-978d47ebb09b90993f1f5c40c8010b8fdb2f6378.zip | |
aesxx/block: refactoring
Diffstat (limited to 'aesxx/include')
| -rw-r--r-- | aesxx/include/aesxx/block.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/aesxx/include/aesxx/block.hpp b/aesxx/include/aesxx/block.hpp index e1379df..e711b82 100644 --- a/aesxx/include/aesxx/block.hpp +++ b/aesxx/include/aesxx/block.hpp @@ -17,25 +17,25 @@ namespace aes { class Block { public: + using Impl = AES_Block; + static Block parse(std::string_view src) { - return Block{src}; + Impl dest; + aes_parse_block(&dest, src.data(), ErrorDetailsThrowsInDestructor{}); + return Block{dest}; } - explicit Block(AES_Block impl) : impl{impl} {} + explicit Block(Impl 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() { + Impl* ptr() { return &impl; } - const AES_Block* ptr() const { + const Impl* ptr() const { return &impl; } @@ -52,7 +52,7 @@ public: } private: - AES_Block impl; + Impl impl; }; } // namespace aes |
