混沌、分形与大数据中的密码学技术
1. 混沌与分形密码学
1.1 加密示例代码
以下是一个加密示例代码,用于生成密钥并对 1GiB 的数据进行加密操作,同时记录加密所花费的时间:
int main(void)
{
struct generation gen;
uint64_t key[3] = {generateStringOfBytes()+rand()%3000, generateStringOfBytes()+rand()%5000, generateStringOfBytes()+rand()%8000};
cout<<"Key 1 -> "<<key[0]<<endl;
cout<<"Key 2 -> "<<key[1]<<endl;
cout<<"Key 3 -> "<<key[2]<<endl;
// generate 1GiB of 1s
uint8_t *message = (uint8_t*)malloc(MESSAGE_LENGTH);
memset(message, 1, MESSAGE_LENGTH);
// perform encryption
generation_initialization(&gen, key);
clock_t s = clock();
encryption(&gen, message, MESSAGE_LENGTH);
clo
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



