这是代码:
#include <QCoreApplication>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <openssl/evp.h>
#include <openssl/aes.h>
#include <iostream>
void en_de_crypt(int should_encrypt, FILE *ifp, FILE *ofp, unsigned char *ckey, unsigned char *ivec) {
const unsigned BUFSIZE=4096;
unsigned char *read_buf = (unsigned char*)malloc(BUFSIZE);
unsigned char *cipher_buf;
unsigned blocksize;
int out_len;
EVP_CIPHER_CTX ctx;
for(int i=0; i<8;i++)
{
printf("%c\n",ckey[i]);
}
printf("\n\n");
for(int i=0; i<8;i++)
{
printf("%c\n",ivec[i]);
}
EVP_CipherInit(&ctx, EVP_aes_256_cbc(), ckey, ivec, should_encrypt);
blocksize = EVP_CIPHER_CTX_block_size(&ctx);
cipher_buf = (unsigned char *)malloc(BUFSIZE + blocksize);
while (1) {
// Read …Run Code Online (Sandbox Code Playgroud) 我已阅读这个和这个,想知道如果我在C#中的功能通过这个库的C#包装使用从非托管C++库,在那里将是具有相同的方案相比在性能上有什么区别,但与非托管C++以及C完全++编写图书馆?我问的是关键性能差异大于1.5倍.请注意我只询问C++库的功能性能(有两种方式 - 使用和不使用C#包装器),隔离其他代码!
编辑后:
我只是想知道我是否想在C#中使用C++动态非托管库(.dll)并且我正在使用包装器 - 它将被编译为中间CIL代码而不是.我想只有包装器被编译为CIL,并且当C#想要从库中使用C++函数时,它只是使用包装器解析并将参数传递给C++函数,所以可能会有一些延迟,但不会就像我通过C#编写整个库一样.如果我误会请纠正我.