Enigma 3.2.2
A Simple, Reliable and Efficient Encryption Tool
Loading...
Searching...
No Matches
Constants.hpp
Go to the documentation of this file.
1#pragma once
2#include "Types.hpp"
4#include <array>
5
6
8 using namespace std::string_literals;
9
10 static constexpr std::uint16_t ENIGMA_SINGLE_PROCESS_UNIQUE_PORT = 36363; // unique app socket port used to avoid multiple instances
11 //static constexpr auto ENIGMA_PACKAGE_NAME = "com.badereddineouaich.enigma"; // unique app id used to avoid multiple instances
12 //static constexpr auto ENIGMA_MAGIC_NUMBER = 0x454e49474d41; // "ENIGMA"
13
14 namespace Algorithm {
15 // Notes:
16 // GCM is defined for block ciphers with a block size of 128 bits. https://en.m.wikipedia.org/wiki/Galois/Counter_Mode
17 // No max password check since we're using KDF SHA-256, his allows you to use a password smaller or larger than the cipher's key size: https://crypto.stackexchange.com/questions/68299/length-of-password-requirement-using-openssl-aes-256-cbc
18 // Why GCM & EAX Modes: https://crypto.stackexchange.com/questions/18860/choice-of-authenticated-encryption-mode-for-whole-messages
19 // https://i.stack.imgur.com/0hNsK.jpg
20
21 static constexpr std::size_t MINIMUM_PASSWORD_LENGTH = 6; // AT LEAST 6 CHARACTERS, FOR SECURITY REASONS.
22 static constexpr char SPECIAL_CHARACTERS[] = R"(!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)";
23
24 namespace AES {
25 //https://www.cryptopp.com/wiki/GCM_Mode
26 }
27 namespace ChaCha20 {
28 // The ChaCha20 algorithm is a stream cipher using a key of 256 bit size.
29 // the ChaCha20 stream cipher does not have a block operation mode therefore it does not use padding.
30 //https://www.cryptopp.com/wiki/ChaCha20
31 }
32 namespace TripleDES {
33 //https://www.cryptopp.com/wiki/TripleDES
34 }
35 namespace Twofish {
36 //https://www.cryptopp.com/wiki/TWOFISH
37 }
38 namespace IDEA {
39 //https://www.cryptopp.com/wiki/IDEA
40 }
41 }
42
43 namespace Database {
44 static const fs::path DATABASE_FILE_PATH = ::Enigma::ResourceManager::getResourcesDir() / "database" / "Enigma.db";
45 // Unfortunately, u cant create multiple tables at once..
46 static constexpr std::array<std::string_view, 2> CREATE_TABLES_SQL = {
47 R"(
48 CREATE TABLE IF NOT EXISTS Encryptions
49 (
50 ide INTEGER PRIMARY KEY AUTOINCREMENT,
51 algo INTEGER NOT NULL, -- algorithm enum id used in encryption. e.g: AES=1 ..
52 title VARCHAR(255) NOT NULL,
53 date_time DATETIME NOT NULL,
54 size INTEGER NOT NULL, -- size of compressed cipher in bytes
55 is_file BOOLEAN NOT NULL,
56 file_ext VARCHAR(9), -- file extension to remember file type on decryption
57
58 CHECK(LENGTH(title) <= 255) -- check title length <= 255
59 );
60 )",
61
62 R"(
63 CREATE TABLE IF NOT EXISTS CipherChunks
64 (
65 idc INTEGER PRIMARY KEY AUTOINCREMENT,
66 ide INTEGER NOT NULL,
67 offset INTEGER NOT NULL,
68 size INTEGER NOT NULL,
69 bytes BLOB NOT NULL,
70
71 FOREIGN KEY(ide) REFERENCES Encryptions(ide) ON DELETE CASCADE -- when an Encryption record is deleted, all associated Cipher records will also be deleted automatically.
72 );
73 )"
74
75 };
76
77 static constexpr std::array<std::string_view, 1> CREATE_INDEXES_SQL = {
78 "CREATE INDEX IF NOT EXISTS ix_Encryptions_title ON Encryptions(title);"};
79
80 }
81
82#if TRANSLATION_ENABLED
83 namespace Translation {
84 static const fs::path TRANSLATION_DIR = "Translation";
85 static const fs::path TRANSLATION_CURRENT_FILE_PATH = fs::path(TRANSLATION_DIR) / ".current"; // application selected language to remember
86 static const fs::path TRANSLATION_ENGLISH_PATH = fs::path(TRANSLATION_DIR) / "English.ini";
87 }
88#endif
89
90 namespace CLI {
91 static constexpr char CLI_HELP_MESSAGE[] = "Say -h or --help to display available options";
92 }
93
94 namespace Links {
95 static const auto ENIGMA_GITHUB_REPOSITORY = "https://github.com/baderouaich/Enigma"s;
96 static const auto ENIGMA_GITHUB_REPOSITORY_ISSUES = ENIGMA_GITHUB_REPOSITORY + "/issues"s;
97 static const auto ENIGMA_GITHUB_REPOSITORY_PULL_REQUESTS = ENIGMA_GITHUB_REPOSITORY + "/pulls"s;
98 static const auto ENIGMA_GITHUB_API = "https://api.github.com/repos/baderouaich/Enigma"s;
99 static const auto ENIGMA_GITHUB_API_LATEST_RELEASE = ENIGMA_GITHUB_API + "/releases/latest"s;
100 }
101
102 namespace Resources {
103 // namespace Textures {
104 // // window runtime icon
105 // static const fs::path ENIGMA_LOGO_PNG_PATH = ::Enigma::ResourceManager::getResourcesDir() / "branding" / "Logo.png";
106 // }
107
108 // namespace Fonts {
109 // static const fs::path AUDIOWIDE_FONT_PATH = ::Enigma::ResourceManager::getResourcesDir() / "fonts" / "Audiowide-Regular.ttf";
110 // static const fs::path MONTSERRAT_FONT_PATH = ::Enigma::ResourceManager::getResourcesDir() / "fonts" / "Montserrat-Medium.ttf";
111 // static const fs::path UBUNTU_FONT_PATH = ::Enigma::ResourceManager::getResourcesDir() / "fonts" / "Ubuntu-Regular.ttf";
112 // }
113 }
114
115 namespace Colors {
116 static constexpr auto COLOR4I_TO_COLOR4F = [](const float r, const float g, const float b, const float a) -> ImVec4 {
117 return ImVec4{r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f};
118 };
119
120 static const ImVec4 RED(1.0f, 0.0f, 0.0f, 1.0f);
121 static const ImVec4 GREEN(0.0f, 1.0f, 0.0f, 1.0f);
122 static const ImVec4 BLUE(0.0f, 0.0f, 1.0f, 1.0f);
123 static const auto ORANGE = COLOR4I_TO_COLOR4F(255, 182, 0, 255);
124
125 static const ImVec4 BACKGROUND_COLOR = COLOR4I_TO_COLOR4F(43, 43, 43, 255); // brown dark gray
126 //static const ImVec4 BACKGROUND_COLOR = COLOR4I_TO_COLOR4F(46, 53, 56, 255); // cyan dark gray
127 //static const ImVec4 BACKGROUND_COLOR = COLOR4I_TO_COLOR4F(46, 51, 56, 255); // blue dark gray
128
129 static const ImVec4 TEXT_COLOR = COLOR4I_TO_COLOR4F(242, 242, 243, 225);
130 static const ImVec4 ERROR_TEXT_COLOR = COLOR4I_TO_COLOR4F(201, 46, 64, 255);
131 static const ImVec4 PASSWORD_MATCH_TEXT_COLOR = COLOR4I_TO_COLOR4F(94, 172, 161, 225);
132
133
134 static const ImVec4 BUTTON_COLOR = COLOR4I_TO_COLOR4F(10, 120, 122, 200);
135 static const ImVec4 BUTTON_COLOR_HOVER = COLOR4I_TO_COLOR4F(29, 188, 191, 200);
136 static const ImVec4 BUTTON_COLOR_ACTIVE = COLOR4I_TO_COLOR4F(11, 65, 66, 200); // PRESSSED
137
138 static const ImVec4 MENUBAR_BACKGROUND_COLOR = COLOR4I_TO_COLOR4F(66, 66, 80, 200);
139
140 static const ImVec4 BACK_BUTTON_COLOR = COLOR4I_TO_COLOR4F(209, 61, 86, 255);
141 static const ImVec4 BACK_BUTTON_COLOR_HOVER = COLOR4I_TO_COLOR4F(232, 81, 107, 255);
142 static const ImVec4 BACK_BUTTON_COLOR_ACTIVE = COLOR4I_TO_COLOR4F(150, 41, 59, 255);
143
144 static const ImVec4 MY_ENCRYPTIONS_BUTTON_COLOR = COLOR4I_TO_COLOR4F(26, 72, 97, 255);
145 static const ImVec4 MY_ENCRYPTIONS_BUTTON_COLOR_HOVER = COLOR4I_TO_COLOR4F(38, 91, 120, 255);
146 static const ImVec4 MY_ENCRYPTIONS_BUTTON_COLOR_ACTIVE = COLOR4I_TO_COLOR4F(10, 132, 199, 255);
147
148 static const ImVec4 TOOLS_BUTTON_COLOR = COLOR4I_TO_COLOR4F(25, 101, 130, 255);
149 static const ImVec4 TOOLS_BUTTON_COLOR_HOVER = COLOR4I_TO_COLOR4F(48, 146, 184, 255);
150 static const ImVec4 TOOLS_BUTTON_COLOR_ACTIVE = COLOR4I_TO_COLOR4F(60, 151, 186, 255);
151
153 //static const ImVec4 LOADING_BACKGROUND_COLOR = { BACKGROUND_COLOR.x, BACKGROUND_COLOR.y, BACKGROUND_COLOR.z, 0.6f };
154 static const ImVec4 LOADING_BACKGROUND_COLOR = {0.0f, 0.0f, 0.0f, 0.8f};
155
156
158
159
160 }
161}
Definition AES.hpp:10
Algorithm abstract class.
Definition Algorithm.hpp:53
static fs::path getResourcesDir()
Returns path to res/ folder Example: /home//Enigma/res/.
Definition IDEA.hpp:11
static constexpr char CLI_HELP_MESSAGE[]
Definition Constants.hpp:91
static const fs::path DATABASE_FILE_PATH
Definition Constants.hpp:44
static constexpr std::array< std::string_view, 2 > CREATE_TABLES_SQL
Definition Constants.hpp:46
static constexpr std::array< std::string_view, 1 > CREATE_INDEXES_SQL
Definition Constants.hpp:77
static constexpr std::size_t MINIMUM_PASSWORD_LENGTH
Definition Constants.hpp:21
static constexpr char SPECIAL_CHARACTERS[]
Definition Constants.hpp:22
static const ImVec4 BACK_BUTTON_COLOR_ACTIVE
static const ImVec4 PASSWORD_MATCH_TEXT_COLOR
static const ImVec4 LOADING_BACKGROUND_COLOR
static const ImVec4 BACK_BUTTON_COLOR_HOVER
static const ImVec4 GREEN(0.0f, 1.0f, 0.0f, 1.0f)
static const ImVec4 MY_ENCRYPTIONS_BUTTON_COLOR
static const auto ORANGE
static constexpr auto COLOR4I_TO_COLOR4F
static const ImVec4 BUTTON_COLOR_ACTIVE
static const ImVec4 BACKGROUND_COLOR
static const ImVec4 MENUBAR_BACKGROUND_COLOR
static const ImVec4 MY_ENCRYPTIONS_BUTTON_COLOR_HOVER
static const ImVec4 TOOLS_BUTTON_COLOR_ACTIVE
static const ImVec4 LOADING_SPINNER_COLOR
static const ImVec4 TOOLS_BUTTON_COLOR_HOVER
static const ImVec4 BACK_BUTTON_COLOR
static const ImVec4 & SCENE_TITLE_BACKGROUND_COLOR
static const ImVec4 TEXT_COLOR
static const ImVec4 BLUE(0.0f, 0.0f, 1.0f, 1.0f)
static const ImVec4 ERROR_TEXT_COLOR
static const ImVec4 BUTTON_COLOR_HOVER
static const ImVec4 TOOLS_BUTTON_COLOR
static const ImVec4 RED(1.0f, 0.0f, 0.0f, 1.0f)
static const ImVec4 MY_ENCRYPTIONS_BUTTON_COLOR_ACTIVE
static const ImVec4 BUTTON_COLOR
static constexpr std::uint16_t ENIGMA_SINGLE_PROCESS_UNIQUE_PORT
Definition Constants.hpp:10