mirror of
https://github.com/avinal/blowfish.git
synced 2026-01-09 22:38:33 +05:30
blowfish header file added
This commit is contained in:
33
include/blowfish/blowfish.hpp
Normal file
33
include/blowfish/blowfish.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @file blowfish.hpp
|
||||
* @author Avinal Kumar
|
||||
* @since February 15, 2021
|
||||
*
|
||||
* 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 <array>
|
||||
|
||||
class blowfish {
|
||||
private:
|
||||
std::array<DWORD, 16 + 2> PArray;
|
||||
std::array<std::array<DWORD, 256>, 4> Sboxes;
|
||||
DWORD F(DWORD x);
|
||||
|
||||
public:
|
||||
blowfish(BYTE *key, WORD keylength);
|
||||
void encrypt(DWORD *xl, DWORD *xr);
|
||||
void decrypt(DWORD *xl, DWORD *xr);
|
||||
};
|
||||
|
||||
#endif // BLOWFISH_HPP
|
||||
Reference in New Issue
Block a user