|
@@ -1,8 +1,9 @@
|
1
|
1
|
#include <iostream>
|
|
2
|
+#include <string>
|
2
|
3
|
#include "include/Crypt.h"
|
3
|
4
|
|
4
|
|
-const char START = 'a';
|
5
|
|
-const char END = 'z';
|
|
5
|
+char START = 'a';
|
|
6
|
+char END = 'z';
|
6
|
7
|
|
7
|
8
|
/**
|
8
|
9
|
@brief Take a string on command line argument to encrypt it. For vigenere encnyption, the text is encrypted with itself as a key
|
|
@@ -10,10 +11,22 @@ const char END = 'z';
|
10
|
11
|
int main( int argc, char* argv[] )
|
11
|
12
|
{
|
12
|
13
|
std::string txt = argv[1] ;
|
|
14
|
+
|
|
15
|
+ if( argc < 1 ){
|
|
16
|
+ std::cout << "Missing argument : need sentance to encrypt" << std::endl;
|
|
17
|
+ return 0;
|
|
18
|
+ }
|
|
19
|
+ if( argc > 1 ){
|
|
20
|
+ START = argv[2][0] ;
|
|
21
|
+ }
|
|
22
|
+ if( argc > 2 ){
|
|
23
|
+ END = argv[3][0] ;
|
|
24
|
+ }
|
|
25
|
+ std::cout << "start, end :" << START << " " << END << std::endl;
|
13
|
26
|
std::cout << "to encrypt :" << txt << std::endl;
|
14
|
|
- std::cout << "code cesar :" << Crypt::cesar(txt, 3 ) << std::endl ;
|
15
|
|
- std::cout << "code vigenere :" << Crypt::vigenere(txt, txt ) << std::endl ;
|
16
|
|
- std::cout << "code atbash :" << Crypt::atbash( txt ) << std::endl ;
|
|
27
|
+ std::cout << "code cesar :" << Crypt::cesar(txt, 3, START, END ) << std::endl ;
|
|
28
|
+ std::cout << "code vigenere :" << Crypt::vigenere(txt, txt, START, END ) << std::endl ;
|
|
29
|
+ std::cout << "code atbash :" << Crypt::atbash( txt, START, END ) << std::endl ;
|
17
|
30
|
|
18
|
31
|
return 0;
|
19
|
32
|
}
|