-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathmain_02.cpp
More file actions
executable file
·51 lines (44 loc) · 1.34 KB
/
main_02.cpp
File metadata and controls
executable file
·51 lines (44 loc) · 1.34 KB
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
44
45
46
47
48
49
50
51
#include "Cesar.h"
#include "OneTime.h"
#include <string>
#include <iostream>
static void encryptString(IEncryptionMethod& encryptionMethod,
std::string const& toEncrypt)
{
size_t len = toEncrypt.size();
encryptionMethod.reset();
for (size_t i = 0; i < len; ++i)
{
encryptionMethod.encryptChar(toEncrypt[i]);
}
std::cout << std::endl;
}
static void decryptString(IEncryptionMethod& encryptionMethod,
std::string const& toDecrypt)
{
size_t len = toDecrypt.size();
encryptionMethod.reset();
for (size_t i = 0; i < len; ++i)
{
encryptionMethod.decryptChar(toDecrypt[i]);
}
std::cout << std::endl;
}
int main()
{
Cesar c;
OneTime o("DedeATraversLesBrumes");
OneTime t("TheCakeIsALie");
encryptString(c, "Je clair Luc, ne pas ? Ze woudrai un kekos !");
decryptString(c, "Mi isirb Xhq, ew jvo ? Zf zszjyir fz ytafk !");
encryptString(c, "KIKOO");
encryptString(c, "LULZ XD");
decryptString(c, "Ziqivun ea Ndcsg.Wji !");
encryptString(t, "Prend garde Lion, ne te trompes pas de voie !");
encryptString(o, "De la musique et du bruit !");
encryptString(t, "Kion li faras? Li studas kaj programas!");
decryptString(t, "Iyipd kijdp Pbvr, xi le bvhttgs tik om ovmg !");
decryptString(o, "Gi pa dunmhmp wu xg tuylx !");
decryptString(t, "Dpsp vm xaciw? Pk cxcvad otq rrykzsmla!");
return 0;
}