bfcodec 0.0.4
Tools and a C/C++ library to manipulate BFCodec-encrypted content
Loading...
Searching...
No Matches
bfcodecpp.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <cstddef>
6#include <expected>
7#include <span>
8#include <string>
9
10#include "bfcodec.h"
11
18
24class BFCODEC_API BFCodec {
25public:
26 BFCodec() = delete;
27
32 static std::expected<BFCodec, BFCodecError> create();
33
39 static std::string message(BFCodecError e);
40
41 BFCodec(const BFCodec &) = delete;
42 BFCodec &operator=(const BFCodec &) = delete;
43
44 BFCodec(BFCodec &&other) noexcept;
45 BFCodec &operator=(BFCodec &&other) noexcept;
46
47 ~BFCodec();
48
54 std::expected<void, BFCodecError> expandKey(std::span<const std::byte> key);
55
62 std::expected<void, BFCodecError> decrypt(std::span<std::byte> data,
63 std::span<const std::byte, 8> iv);
64
71 std::expected<void, BFCodecError> encrypt(std::span<std::byte> data,
72 std::span<const std::byte, 8> iv);
73
74private:
75 explicit BFCodec(C_BLOWFISH *blf) noexcept;
76
77 C_BLOWFISH *blf_;
78};
BFCodecError
Definition bfcodecpp.h:13
@ DataSizeNotMultipleOf8
C++23 wrapper around the bfcodec C library.
Definition bfcodecpp.h:24
Definition bfcodec.c:7