feat: add more robust tests

- add test to cover corner cases and known failure points

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2025-12-06 18:23:08 +05:30
parent 5448271298
commit 612086dfb7
16 changed files with 386 additions and 191 deletions
+3 -3
View File
@@ -9,15 +9,15 @@
#include <cstdint>
#include <string>
#define MAXKEYBYTES 56 // 448 bits max
static constexpr uint32_t N = 16;
static constexpr uint32_t BF_NUM_ROUNDS = 16;
static constexpr uint32_t BF_MAX_KEYBYTES = 56;
#if !defined(BLOWFISH_BLOWFISH_H_)
#define BLOWFISH_BLOWFISH_H_
class Blowfish {
private:
std::array<uint32_t, N + 2> PArray{};
std::array<uint32_t, BF_NUM_ROUNDS + 2> PArray{};
std::array<std::array<uint32_t, 256>, 4> Sboxes{};
uint32_t F(uint32_t x) const noexcept;
+3 -3
View File
@@ -9,15 +9,15 @@
#include <cstdint>
#include <string>
#define MAXKEYBYTES 56 // 448 bits max
static constexpr uint64_t BF2_NUM_ROUNDS = 64;
static constexpr uint64_t BF2_MAX_KEYBYTES = 56;
#if !defined(BLOWFISH_BLOWFISH2_H_)
#define BLOWFISH_BLOWFISH2_H_
class Blowfish2 {
private:
static constexpr uint64_t N = 64;
std::array<uint64_t, N + 2> PArray{};
std::array<uint64_t, BF2_NUM_ROUNDS + 2> PArray{};
std::array<std::array<uint64_t, 256>, 8> Sboxes{};
uint64_t F(uint64_t x) const noexcept;