thenuke321

Untitled

Mar 11th, 2015
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. string encode(string data,string key)
  2. {
  3.  
  4.     //wchar_t pass[MAX_PASSWD_LEN+1];
  5.     char *plaintext = new char[data.size() + 20];
  6.     char *ciphertext = new char[data.size() + 80];
  7.     char *password = new char[key.size()+1];
  8.     unsigned long passlen = 10;
  9.     unsigned long plaintext_length(data.size() + 20);
  10.     unsigned long ciphertext_length(data.size() + 80);
  11.     strcpy(password,key.c_str());
  12.     strcpy(plaintext,data.c_str());
  13.     //mbstowcs(password,key.c_str(),1025);
  14.    
  15.     AESStringCrypt(password,passlen,plaintext,plaintext_length,ciphertext);
  16.  
  17.     delete[] plaintext;
  18.  
  19.     string *outData = new string;
  20.     *outData = ciphertext;
  21.     delete[] ciphertext;
  22.     return *outData;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment