Added a FeistelManager to en/decipher arbitrarily long messages using cipher block chaining

This commit is contained in:
Leonetienne
2021-12-06 00:39:58 +01:00
parent 61a74f89a5
commit 4855869e54
8 changed files with 202 additions and 10 deletions

View File

@@ -8,7 +8,11 @@
class Feistel
{
public:
Feistel(const Block& key);
explicit Feistel(const Block& key);
Feistel(const Feistel& other) = delete;
Feistel(Feistel&& other) noexcept = delete;
~Feistel();
//! Will set the seed-key for this feistel network.
@@ -16,14 +20,14 @@ public:
void SetKey(const Block& key);
//! Will encipher a data block via the set seed-key
Block Encipher(const Block& data);
Block Encipher(const Block& data) const;
//! Will decipher a data block via the set seed-key
Block Decipher(const Block& data);
Block Decipher(const Block& data) const;
private:
//! Will run the feistel rounds, with either regular key order or reversed key order
Block Run(const Block& data, bool reverseKeys);
Block Run(const Block& data, bool reverseKeys) const;
//! Arbitrary cipher function
static Halfblock F(Halfblock m, const Block& key);