keymasterviriya1150

บูทฟอร์ด caesar

Jan 14th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. //Decrypt Aj.Sang comsecurity
  2. #include <iostream>
  3. #include <string>
  4.  
  5. void encrypt( std::string &iostr , int key )
  6. {
  7.     key %= 26;
  8.     int ch;
  9.  
  10.     for( auto &it : iostr )
  11.     {
  12.         ch = tolower(it) + key;
  13.         if( ch > 'z' )
  14.             ch -= 26;
  15.         it = ch;
  16.     }
  17. }
  18.  
  19. int main()
  20. {
  21.     std::string source = "TJUAHJFAHBUTAKHAEISTGINTEDJZPDEVTBDIFSIXJFXVWDZPZPTHZAHJZDGZBHFTEKEZTNWPDGPGBTHZTFEINTZPDJUICHGXAZXBHAGIJZDJXXNIRTBHAHBUTVHBZICWTEZTBJTXBIVT";
  22.    
  23.     for(int i=26;i>=0;i--){
  24.         std::cout << std::endl;
  25.         encrypt( source , i );
  26.         std::cout << source << std::endl;
  27.     }
  28.  
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment