8 lines
273 B
C
8 lines
273 B
C
#include "file_encryptor.h"
|
|
|
|
// XOR 加密/解密
|
|
void xor_encrypt_decrypt(uint8_t *data, size_t data_len, const uint8_t *key, size_t key_len) {
|
|
for (size_t i = 0; i < data_len; ++i) {
|
|
data[i] ^= key[i % key_len]; // 使用密钥进行 XOR 加密/解密
|
|
}
|
|
} |