#include <stdio.h> #include <stdint.h> #include<windows.h> unsigned long str2[32] ={46,162,154,93,216,119,117,77,224,124,80,69,114,165,248,93,109,14,98,20,102,95,216,91,138,93,196,200,116,32,253,101}; unsigned int key[4]={1,2,3,4}; void decrypt(unsigned int *A,unsigned int *B) { int j; unsigned int v0 = A[0],v1 = A[1],delta = 221492336,sum = delta <<5; for(j=0;j<32;j++) { v1 -= (v0 + sum) ^ (B[2] + 16 * v0) ^ ((v0 >> 5) + B[3]); v0 -= (v1 + sum) ^ (*B + 16 * v1) ^ ((v1 >> 5) + B[1]); sum -= delta; } A[0] = v0; A[1] = v1; } unsigned int v4[2]; int main() { for ( int i = 24; i >= 0; i -= 8 ) { for (int j = 0; j <= 1; ++j ) { v4[j]=0; for (int k = 3; k >=0 ; --k ) { v4[j] = v4[j] << 8; v4[j] += str2[4 * j + i + k]; } } decrypt(&v4[0],key); for (int j = 0; j <= 1; ++j ) { for (int k = 0; k <= 3; ++k ) { str2[4 * j + i + k]=v4[j] ; v4[j] = v4[j] >> 8; } } } for(int i=0;i<32;i++) printf("%c",str2[i]); return 0; }
|