1234567891011121314151617181920212223242526272829303132 |
- #include <iostream>
- #include <string>
- #include "include/Crypt.h"
-
- char START = 'a';
- char END = 'z';
-
- /**
- @brief Take a string on command line argument to encrypt it. For vigenere encnyption, the text is encrypted with itself as a key
- **/
- int main( int argc, char* argv[] )
- {
- std::string txt = argv[1] ;
-
- if( argc < 1 ){
- std::cout << "Missing argument : need sentance to encrypt" << std::endl;
- return 0;
- }
- if( argc > 1 ){
- START = argv[2][0] ;
- }
- if( argc > 2 ){
- END = argv[3][0] ;
- }
- std::cout << "start, end :" << START << " " << END << std::endl;
- std::cout << "to encrypt :" << txt << std::endl;
- std::cout << "code cesar :" << Crypt::cesar(txt, 3, START, END ) << std::endl ;
- std::cout << "code vigenere :" << Crypt::vigenere(txt, txt, START, END ) << std::endl ;
- std::cout << "code atbash :" << Crypt::atbash( txt, START, END ) << std::endl ;
-
- return 0;
- }
|