mirror of
https://github.com/avinal/blowfish.git
synced 2026-01-10 06:48:32 +05:30
changed according to Google Guidelines
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
* @file blowfish.hpp
|
* @file blowfish.hpp
|
||||||
* @author Avinal Kumar
|
* @author Avinal Kumar
|
||||||
* @since February 15, 2021
|
* @since February 15, 2021
|
||||||
@@ -6,28 +6,30 @@
|
|||||||
* Blowfish Algorithm Header File
|
* Blowfish Algorithm Header File
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAXKEYBYTES 56 // 448 bits max
|
|
||||||
|
|
||||||
#define DWORD unsigned long
|
|
||||||
#define WORD unsigned int
|
|
||||||
#define BYTE unsigned char
|
|
||||||
|
|
||||||
#if !defined(BLOWFISH_HPP)
|
|
||||||
#define BLOWFISH_HPP
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class blowfish {
|
#define MAXKEYBYTES 56 // 448 bits max
|
||||||
|
#define N 16
|
||||||
|
|
||||||
|
#define BYTE unsigned char
|
||||||
|
#define DWORD unsigned long
|
||||||
|
#define WORD unsigned int
|
||||||
|
|
||||||
|
#if !defined(BLOWFISH_BLOWFISH_H_)
|
||||||
|
#define BLOWFISH_BLOWFISH_H_
|
||||||
|
|
||||||
|
class Blowfish {
|
||||||
private:
|
private:
|
||||||
std::array<DWORD, 16 + 2> PArray;
|
std::array<DWORD, N + 2> PArray;
|
||||||
std::array<std::array<DWORD, 256>, 4> Sboxes;
|
std::array<std::array<DWORD, 256>, 4> Sboxes;
|
||||||
DWORD F(DWORD x);
|
DWORD F(DWORD x);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
blowfish(BYTE *key, WORD keylength);
|
Blowfish(std::string const &key);
|
||||||
void encrypt(DWORD *xl, DWORD *xr);
|
void encrypt(DWORD &xl, DWORD &xr);
|
||||||
void decrypt(DWORD *xl, DWORD *xr);
|
void decrypt(DWORD &xl, DWORD &xr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BLOWFISH_HPP
|
#endif // BLOWFISH_BLOWFISH_H_
|
||||||
Reference in New Issue
Block a user