No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.cpp 906B

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