CryEntryBuffer
简单的RC4代码加密实现
struct rc4_state
{
int x, y, m[256];
};
void rc4_setup(struct rc4_state *s, unsigned char *key, int length)
{
int i, j, k, *m, a;
s->x = 0;
s->y = 0;
m = s->m;
for(i = 0; i < 256; i++)
{
m[i] = i;
}
j = k = 0;
for(i = 0; i < 256; i++)
{
a = m[i];
j = (unsigned char) (j + a + key[k]);
m[i] = m[j]; m[j] = a;
if(++k >= length) k = 0;
}
}
//******************************************************************************
void rc4_crypt( struct rc4_state *s, unsigned char *data, int length)
{
int i, x, y, *m, a, b;
x = s->x;
y = s->y;
m = s->m;
for( i = 0; i < length; i++)
{
x = (unsigned char) (x + 1); a = m[x];
y = (unsigned char) (y + a);
m[x] = b = m[y];
m[y] = a;
data[i] ^= m[(unsigned char) (a + b)];
}
s->x = x;
s->y = y;
}
BOOL EntryptionBuf(char* Buf, DWORD dwlen)
{
BYTE rc4_key[8] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
rc4_state rc4_test;
memset(&rc4_test, 0, sizeof(rc4_test));
try
{
rc4_setup(&rc4_test, rc4_key, 8);
rc4_crypt(&rc4_test, (unsigned char*)Buf, dwlen);
}
catch (...)
{
return FALSE;
}
return TRUE;
}
int main()
{
EntryptionBuf(youBuf,youBufSize);
}
作者:IBinary
坚持两字,简单,轻便,但是真正的执行起来确实需要很长很长时间.当你把坚持两字当做你要走的路,那么你总会成功. 想学习,有问题请加群.群号:725864912(收费)群名称: 逆向学习小分队 群里有大量学习资源. 以及定期直播答疑.有一个良好的学习氛围. 涉及到外挂反外挂病毒 司法取证加解密 驱动过保护 VT 等技术,期待你的进入。
详情请点击链接查看置顶博客 https://www.cnblogs.com/iBinary/p/7572603.html
本文来自博客园,作者:iBinary,未经允许禁止转载 转载前可联系本人.对于爬虫人员来说如果发现保留起诉权力.https://www.cnblogs.com/iBinary/p/11975747.html
欢迎大家关注我的微信公众号.不定期的更新文章.更新技术. 关注公众号后请大家养成 不白嫖的习惯.欢迎大家赞赏. 也希望在看完公众号文章之后 不忘 点击 收藏 转发 以及点击在看功能. QQ群: