Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int decryptnosfile(unsigned char *cData, unsigned int f_buffer, unsigned char *cOut, unsigned int &nOut)
- {
- static unsigned char table[] = { 0, 0x20,'-','.','0','1','2','3','4','5','6','7','8','9', 0x0d };
- unsigned int i, offset, len;
- unsigned char size, c;
- len = f_buffer;
- unsigned char *cBuffer;
- cBuffer = (unsigned char*)malloc(f_buffer + 1);
- memcpy(cBuffer, cData, f_buffer);
- offset = nOut = 0;
- while(offset < len
- {
- if(cBuffer[offset] == 0xFFu)
- {
- offset++;
- *(cOut + nOut++) = 0x0d;
- continue;
- }
- size = cBuffer[offset++];
- i = 0;
- if ((size & 0x80U) == 0)
- {
- while ((i++ < size) && (offset < len))
- {
- *(cOut + nOut++) = (cBuffer[offset++] ^ 0x33U);
- }
- }
- else
- {
- size &= 0x7FU;
- while ((i < size) && (offset < len))
- {
- c = cBuffer[offset++];
- *(cOut + nOut++) = (table[(c & 0xF0U) >> 4]);
- if (table[c & 0x0FU] != 0)
- *(cOut + nOut++) = table[c & 0x0FU];
- i += 2;
- }
- }
- }
- free(cBuffer);
- return offset;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement