Advertisement
PurePytanium

x

Aug 27th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. #include"Kxaos.h"
  4. using namespace std;
  5. string key = "1234567890123456";
  6. string pla;
  7. string Encrypt(string data){
  8.     int len=length(data),keylen=length(key),min_a;
  9.     char now,mod,prev='~';
  10.     string tot="",temp="";
  11.     for(int i=0;i<len;i++){    
  12.         cout<<"Current Letter: "<<data[i]<<endl;
  13.         now=data[i];
  14.        
  15.         cout<<now<<"+"<<keylen*4<<"=";
  16.         now+=keylen*4;
  17.         cout<<now<<endl;
  18.        
  19.         cout<<now<<"+"<<len*len<<"=";
  20.         now+=len*len;
  21.         cout<<now<<endl;
  22.        
  23.         cout<<now<<"+"<<prev<<"=";
  24.         now+=prev;
  25.         cout<<now<<endl;
  26.        
  27.         min_a=0;
  28.         while(isSpecial(now)){
  29.             cout<<now<<" is special; -¤ =";
  30.             now-='¤';
  31.             cout<<now<<endl;
  32.             min_a++;
  33.         }
  34.         tot+=now;
  35.         prev=now;
  36.         temp+=toString(min_a);
  37.         pla=temp;
  38.         cout<<endl;
  39.     }
  40.     return tot;
  41. }
  42. string Decrypt(string data){
  43.     int len=length(data),keylen=length(key);
  44.     char now,mod,prev='~';
  45.     string tot="",curr_a;
  46.     for(int i=0;i<len;i++){
  47.         now=data[i];
  48.         now-=prev;
  49.         now-=len*len;
  50.         now-=keylen*4;
  51.         curr_a="";
  52.         curr_a+=pla[i];
  53.         for(int j=0;j<toInteger(curr_a);j++){
  54.             now+='¤';
  55.         }
  56.         tot+=now;
  57.         prev=data[i];
  58.     }
  59.     return tot;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement