123456789101112131415161718192021222324252627282930313233343536373839 |
- #include <iostream>
- #include <string>
- #include "include/Crypt.h"
- #include "include/Test.h"
-
- char START = START;
- char END = END;
-
- /**
- @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::string test_1 = "la mer à boire" ;
- std::string test_2 = "xyzabc" ;
-
- Test::assertEqual( Crypt::cesar( test_1, 3, START, END ), "od phu à erluh") ;
- Test::assertEqual( Crypt::vigenere( test_1, test_1, START, END ), "xb zjj à ddrjj") ;
- Test::assertEqual( Crypt::atbash( test_1, START, END ), "oz nvi à ylriv") ;
-
- Test::assertEqual( Crypt::cesar( test_2, 3, START, END ), "abcdef") ;
- Test::assertEqual( Crypt::vigenere( test_2, test_1, START, END ), "jzzngu") ;
- Test::assertEqual( Crypt::atbash( test_2, START, END ), "cbazyx") ;
-
- return 0;
- }
|