Skip to content

Commit

Permalink
Create qrc.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 15, 2024
1 parent 3b596b1 commit 6ec4bef
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions models/qrc/qrc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <iostream>
#include <openssl/aes.h>
#include <openssl/err.h>

class QRC {
public:
QRC() {
// Initialize the AES-256 encryption algorithm
EVP_CIPHER_CTX *ctx;
ctx = EVP_CIPHER_CTX_new();
EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv);
}

void encrypt_data(const char *data) {
// Encrypt the data using AES-256
int len;
unsigned char *out;
EVP_EncryptUpdate(ctx, &out, &len, (unsigned char *)data, strlen(data));
//...
}

void decrypt_data(const char *data) {
// Decrypt the data using AES-256
int len;
unsigned char *out;
EVP_DecryptUpdate(ctx, &out, &len, (unsigned char *)data, strlen(data));
//...
}
};

int main() {
QRC qrc;
const char *data = "Top Secret Information";
qrc.encrypt_data(data);
//...
return 0;
}

0 comments on commit 6ec4bef

Please sign in to comment.