-
Notifications
You must be signed in to change notification settings - Fork 0
/
CaesarCipher.h
45 lines (34 loc) · 1.16 KB
/
CaesarCipher.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _CAESAR_CIPHER_H_
#define _CAESAR_CIPHER_H_
#include <windows.h>
#include <string>
class CaesarCipher
{
public:
CaesarCipher(std::string pathToDll);
~CaesarCipher();
int EncryptTxt(const int key, std::string, std::string);
int DecryptTxt(const int key, std::string fromPath, std::string outPath);
std::string EncryptStr(std::string message, const int key);
std::string DecryptStr(std::string message, const int key);
size_t GetBufferCapacity() const;
bool ifKeyValid(const int key) const;
private:
char* GetNextChunkFromTxt(std::string&, std::string);
char* GetNextChunkFromStr(std::string&);
bool isPrintable(char) const;
bool ifLenValid(std::string message) const;
// dll function pointers
typedef char* (*encrypt_ptr_t)(char*, const int);
typedef char* (*decrypt_ptr_t)(char*, int);
// Const dll function naming
const char* encryptProcName = "EncryptStr";
const char* decryptProcName = "DecryptStr";
// Proc pointers
encrypt_ptr_t encryptProcAddress = nullptr;
decrypt_ptr_t decryptProcAddress = nullptr;
HINSTANCE dllHandle = nullptr;
char* chunkBuffer = nullptr;
static const size_t BUFFERCAPACITY = 10;
};
#endif // !_CAESAR_CIPHER_H