Created
November 17, 2015 01:56
-
-
Save Mooophy/4deca9aad742ae6a2f1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <iostream> | |
| #include "dll.h" | |
| #include "aes.h" | |
| using CryptoPP::AES; | |
| #include "modes.h" | |
| using CryptoPP::CBC_Mode; | |
| #include "filters.h" | |
| using CryptoPP::StringSink; | |
| using CryptoPP::StringSource; | |
| using CryptoPP::StreamTransformationFilter; | |
| using CryptoPP::HashFilter; | |
| using namespace std; | |
| int main() | |
| { | |
| string strkey = "wNse6xsQ4sQ7tFl0cYk8qFjpT9ZbAP2b"; | |
| string striv = "cBOA7VjyNadaNqGd"; | |
| byte iv[16]; | |
| byte key[32]; | |
| std::string ciper; | |
| memset(iv,0,sizeof(iv)); | |
| memset(key,0,sizeof(key)); | |
| for(unsigned i = 0; i < strkey.length(); i++){ | |
| key[i] = (byte)strkey.at(i); | |
| } | |
| for(unsigned i = 0; i < striv.length(); i++){ | |
| iv[i] = (byte)striv.at(i); | |
| } | |
| string data("12345"); | |
| { | |
| CBC_Mode< AES >::Encryption e; | |
| e.SetKeyWithIV(key, sizeof(key), iv); | |
| StringSource ss(data,true,new StreamTransformationFilter(e, new CryptoPP::StringSink(ciper),StreamTransformationFilter::ZEROS_PADDING)); | |
| } | |
| system("pause"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment