mirror of
https://github.com/avinal/blowfish.git
synced 2026-01-09 22:38:33 +05:30
changed according to Google Guidelines
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* @file blowfish.hpp
|
||||
* @author Avinal Kumar
|
||||
* @since February 15, 2021
|
||||
@@ -6,28 +6,30 @@
|
||||
* 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>
|
||||
#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:
|
||||
std::array<DWORD, 16 + 2> PArray;
|
||||
std::array<DWORD, N + 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);
|
||||
Blowfish(std::string const &key);
|
||||
void encrypt(DWORD &xl, DWORD &xr);
|
||||
void decrypt(DWORD &xl, DWORD &xr);
|
||||
};
|
||||
|
||||
#endif // BLOWFISH_HPP
|
||||
#endif // BLOWFISH_BLOWFISH_H_
|
||||
Reference in New Issue
Block a user