Advertisement
amgineyoc

Untitled

Aug 30th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. int decryptnosfile(unsigned char *cData, unsigned int f_buffer, unsigned char *cOut, unsigned int &nOut)
  2.         {
  3.          static unsigned char table[] = { 0, 0x20,'-','.','0','1','2','3','4','5','6','7','8','9', 0x0d };
  4.  
  5.          unsigned int i, offset, len;
  6.  
  7.          unsigned char size, c;
  8.  
  9.          len = f_buffer;
  10.  
  11.          unsigned char *cBuffer;
  12.          cBuffer = (unsigned char*)malloc(f_buffer + 1);
  13.          memcpy(cBuffer, cData, f_buffer);
  14.  
  15.          offset = nOut = 0;
  16.  
  17.          while(offset < len
  18.          {
  19.          if(cBuffer[offset] == 0xFFu)
  20.          {
  21.          offset++;
  22.          *(cOut + nOut++) = 0x0d;
  23.          continue;
  24.          }
  25.  
  26.          size = cBuffer[offset++];
  27.  
  28.          i = 0;
  29.          if ((size & 0x80U) == 0)
  30.          {
  31.          while ((i++ < size) && (offset < len))
  32.          {
  33.          *(cOut + nOut++) = (cBuffer[offset++] ^ 0x33U);
  34.          }
  35.          }
  36.          else
  37.          {
  38.          size &= 0x7FU;
  39.          while ((i < size) && (offset < len))
  40.          {
  41.          c = cBuffer[offset++];
  42.  
  43.          *(cOut + nOut++) = (table[(c & 0xF0U) >> 4]);
  44.          if (table[c & 0x0FU] != 0)
  45.          *(cOut + nOut++) = table[c & 0x0FU];
  46.  
  47.          i += 2;
  48.          }
  49.          }
  50.          }
  51.  
  52.          free(cBuffer);
  53.          return offset;
  54.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement