Advertisement
Guest User

Untitled

a guest
Jul 12th, 2010
321
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "camellia.h"
  2. #include <cstdio>
  3. #include <cstring>
  4.  
  5. int main()
  6. {
  7.     //unsigned char key[] = { 'D', 'i', 'e', 's', ' ', 'i', 'r', 'a', 'e', ' ', '\x90', '\xBB', '\x95', 'i', '\x94', '\xC5' }; //trial
  8.     unsigned char key[] = "agbsvAZJVBqMwzmE";
  9.  
  10.     FILE *fp = fopen("exec.dmp", "rb");
  11.  
  12.     if (fp == NULL) return 1;
  13.  
  14.     fseek(fp, 0, SEEK_END);
  15.     int size = ftell(fp);
  16.     fseek(fp, 0, SEEK_SET);
  17.  
  18.     unsigned char *buff = new unsigned char[size];
  19.     fread(buff, 1, size, fp);
  20.     fclose(fp);
  21.  
  22.     unsigned char *decbuff = new unsigned char[size];
  23.     memset(decbuff, 0, size);
  24.  
  25.     KEY_TABLE_TYPE kt;
  26.     memset(kt, 0, sizeof(kt));
  27.     Camellia_Ekeygen(128, key, kt);
  28.  
  29.     unsigned char *enc = buff, *dec = decbuff;
  30.     for (int i = 0; i < size / CAMELLIA_BLOCK_SIZE; i++)
  31.     {
  32.         Camellia_DecryptBlock(128, enc, kt, dec);
  33.         enc += CAMELLIA_BLOCK_SIZE;
  34.         dec += CAMELLIA_BLOCK_SIZE;
  35.     }
  36.  
  37.     fp = fopen("out.bin", "wb");
  38.     fwrite(decbuff, 1, size, fp);
  39.     fclose(fp);
  40.  
  41.     delete[] buff;
  42.     delete[] decbuff;
  43. }
Advertisement
RAW Paste Data Copied
Advertisement