密码学——凯撒加密
古典加密方案,通过对字符简单的增加x,来进行加密。
免杀使用的时候,顺手可以加个亦或进去,增加点复杂度。
#pragma once
#include<stdio.h>
void Caesar_Encryption(unsigned char *strInput,int nLength, int nOffset1, int nOffset2) {
unsigned char* p = strInput;
for (int i = 0; i < nLength; i++) {
//凯撒加密
*p = *p + nOffset1;
//亦或加密
*p = *p ^ nOffset2;
p++;
}
}
void Caesar_Decryption(unsigned char* strInput, int nLength, int nOffset1, int nOffset2) {
unsigned char* p = strInput;
for (int i = 0; i < nLength; i++) {
//亦或加密
*p = *p ^ nOffset2;
//凯撒加密
*p = *p - nOffset1;
p++;
}
}