mirror of
https://github.com/avinal/blowfish.git
synced 2026-07-04 04:10:09 +05:30
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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user