之前寫過一篇《php 使用異或(XOR)加密/解密文件》,但php執行的速度很慢,因此這次使用C重寫,速度有很大的提高。
xor_encrypt.c
/** XOR 加密/解密文件 */
#define TRUE 1
#define FALSE 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h> // 如果在/usr/include/找不到,可以在/usr/include/sys/復制過去
// 輸出信息
void msg_log(char *str);
// 判斷文件是否存在
int file_exists(char *filename);
// 主函數
//