1 Star 0 Fork 28

郭昕灏/文件软硬件加解密平台

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
RC4.h 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
qingfengfumeng 提交于 2024-09-13 15:38 . update RC4.h.
#ifndef RC4_H
#define RC4_H
/**************************************************
* project name: RC4
* author: wang binbin
* completion time: 2024.3.30
*************************************************/
#pragma once
#include <iostream>
#include <string>
#include<random>
#include <fstream>
#include<sstream>
#include <vector>
#include<ctime>
using namespace std;
#define SECRET_KEY_PATH "key.txt"
class RC4
{
public:
RC4();
// Generate random key
void genKey(std::string outputname);
// Get key
void getKey(std::string filename);
// The variable len is the length of the data. Encryption is performed when model= 0 and decryption is performed when model=1.
void enc_dec(char* data, long long len, int model);
// Process the file. Encryption is performed when model= 0 and decryption is performed when model=1.
bool enc_dec_file(const std::string filename, const std::string outname, int model);
private:
std::string Key;
// Swap two elements
void swap(unsigned char& a, unsigned char& b);
// Example Initialize the Sbox
void initSbox();
};
#endif // RC4_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/guo-xinhao/cryptography_file_protection.git
git@gitee.com:guo-xinhao/cryptography_file_protection.git
guo-xinhao
cryptography_file_protection
文件软硬件加解密平台
master

搜索帮助