#include <stdio.h> int size1 = 0x100; int main() { unsigned char enc[44]={ 0xF7, 0x2E, 0x34, 0xF0, 0x72, 0xCF, 0x5E, 0x0A, 0xBB, 0xEC, 0xB1, 0x2B, 0x70, 0x88, 0x88, 0xED, 0x46, 0x38, 0xDB, 0xDA, 0x6C, 0xBD, 0xD4, 0x06, 0x77, 0xF2, 0xCF, 0x56, 0x88, 0xC6, 0x31, 0xD2, 0xB7, 0x5A, 0xC1, 0x42, 0xB0, 0xF4, 0x48, 0x37, 0xF5, 0x2C, 0xF5, 0x58}; unsigned char sbox[257] = { 0 }; unsigned int i, j, k; int tmp; char key[] = { 93,66,98,41,3,54,71,65,21,54 }; int len = 0; char* p = (char *)enc;
while (*p) { len++; p++; } for (i = 0; i < size1; i++) { sbox[i] = i; }
j = k = 0; for (i = 0; i < size1; i++) { tmp = sbox[i]; j = (2 * j + tmp + key[k]) % size1; sbox[i] = sbox[j]; sbox[j] = tmp; if (++k >= 10) k = 0; } j = k = 0; int R; for (i = 0; i < len; i++) { j = (j + k) % size1; k = (k + sbox[j]) % size1;
tmp = sbox[j]; sbox[j] = sbox[k]; sbox[k] = tmp;
R = sbox[(sbox[j] + sbox[k] + k) % size1]; enc[i] -= (i % 13); enc[i] ^= R ; } printf("%s",enc); }
|