36 lines
		
	
	
		
			581 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			581 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <string>
 | |
| #include <iostream>
 | |
| #include <fstream>
 | |
| #include <cstring>
 | |
| 
 | |
| #include "cryptography.hpp"
 | |
| #include "buffer.hpp"
 | |
| #include "aes256.hpp"
 | |
| 
 | |
| Cryptography::Cryptography(std::string password)
 | |
| {
 | |
| 	key = password;
 | |
| }
 | |
| 
 | |
| Cryptography::~Cryptography()
 | |
| {
 | |
| }
 | |
| 
 | |
| void Cryptography::change_pass(std::string password)
 | |
| {
 | |
| 	key = password;
 | |
| }
 | |
| 
 | |
| bool Cryptography::encrypt(Buffer &plain, Buffer &encrypted)
 | |
| {
 | |
| 
 | |
| 	Aes256::encrypt(key, plain, encrypted);
 | |
| 
 | |
| 	return true;
 | |
| }
 | |
| 
 | |
| bool Cryptography::decrypt(Buffer &encrypted, Buffer &decrypted)
 | |
| {
 | |
| 	Aes256::decrypt(key, encrypted, decrypted);
 | |
| 	return true;
 | |
| } | 
