GetUnicodeBytesFromChar Improvements

Posts 112 of 12 · Page 1 of 1
GetUnicodeBytesFromChar Improvements
The function GetUnicodeBytesFromChar (shown at the very below) is a really Ugly and rather in-efficient function using way more performance than is actually required. I was playing around with my hack tried to find an alternative to the function.

The Improved function is much faster because of the reasons below:

  • Switch statements loses performance over 7 switched (x86 Architecture thing)
  • The function uses reference for the output which is proven to be faster because no memory have to be created.
  • Because this function is not so simple it can easily be inline meaning no memory have to be copied somewhere then read elsewhere for each character.
  • It also gain performance because x86 architecture is familiar with multiplying by 4(32 bits, 4 Bytes) and can do this very fast.
  • Its short nice code that is not filled with cases



Code:
void GetUnicodeBytesFromChar(char curChar, WORD& bOut)
{
    bOut = (WORD)curChar * 4;
}
It's actually pretty simple crack for this ugly function.
Code:
void GetUnicodeBytesFromChar(int curChar, BYTE *bOut)        {
            if (!bOut) return;


            switch (curChar)
            {
            case ' ': bOut[0] = 0x80; bOut[1] = 0x00; break;
            case '0': bOut[0] = 0xC0; bOut[1] = 0x00; break;
            case '1': bOut[0] = 0xC4; bOut[1] = 0x00; break;
            case '2': bOut[0] = 0xC8; bOut[1] = 0x00; break;
            case '3': bOut[0] = 0xCC; bOut[1] = 0x00; break;
            case '4': bOut[0] = 0xD0; bOut[1] = 0x00; break;
            case '5': bOut[0] = 0xD4; bOut[1] = 0x00; break;
            case '6': bOut[0] = 0xD8; bOut[1] = 0x00; break;
            case '7': bOut[0] = 0xDC; bOut[1] = 0x00; break;
            case '8': bOut[0] = 0xE0; bOut[1] = 0x00; break;
            case '9': bOut[0] = 0xE4; bOut[1] = 0x00; break;


            case 'A': bOut[0] = 0x04; bOut[1] = 0x01; break;
            case 'B': bOut[0] = 0x08; bOut[1] = 0x01; break;
            case 'C': bOut[0] = 0x0C; bOut[1] = 0x01; break;
            case 'D': bOut[0] = 0x10; bOut[1] = 0x01; break;
            case 'E': bOut[0] = 0x14; bOut[1] = 0x01; break;
            case 'F': bOut[0] = 0x18; bOut[1] = 0x01; break;
            case 'G': bOut[0] = 0x1C; bOut[1] = 0x01; break;
            case 'H': bOut[0] = 0x20; bOut[1] = 0x01; break;
            case 'I': bOut[0] = 0x24; bOut[1] = 0x01; break;
            case 'J': bOut[0] = 0x28; bOut[1] = 0x01; break;
            case 'K': bOut[0] = 0x2C; bOut[1] = 0x01; break;
            case 'L': bOut[0] = 0x30; bOut[1] = 0x01; break;
            case 'M': bOut[0] = 0x34; bOut[1] = 0x01; break;
            case 'N': bOut[0] = 0x38; bOut[1] = 0x01; break;
            case 'O': bOut[0] = 0x3C; bOut[1] = 0x01; break;
            case 'P': bOut[0] = 0x40; bOut[1] = 0x01; break;
            case 'Q': bOut[0] = 0x44; bOut[1] = 0x01; break;
            case 'R': bOut[0] = 0x48; bOut[1] = 0x01; break;
            case 'S': bOut[0] = 0x4C; bOut[1] = 0x01; break;
            case 'T': bOut[0] = 0x50; bOut[1] = 0x01; break;
            case 'U': bOut[0] = 0x54; bOut[1] = 0x01; break;
            case 'V': bOut[0] = 0x58; bOut[1] = 0x01; break;
            case 'W': bOut[0] = 0x5C; bOut[1] = 0x01; break;
            case 'X': bOut[0] = 0x60; bOut[1] = 0x01; break;
            case 'Y': bOut[0] = 0x64; bOut[1] = 0x01; break;
            case 'Z': bOut[0] = 0x68; bOut[1] = 0x01; break;


            case 'a': bOut[0] = 0x84; bOut[1] = 0x01; break;
            case 'b': bOut[0] = 0x88; bOut[1] = 0x01; break;
            case 'c': bOut[0] = 0x8C; bOut[1] = 0x01; break;
            case 'd': bOut[0] = 0x90; bOut[1] = 0x01; break;
            case 'e': bOut[0] = 0x94; bOut[1] = 0x01; break;
            case 'f': bOut[0] = 0x98; bOut[1] = 0x01; break;
            case 'g': bOut[0] = 0x9C; bOut[1] = 0x01; break;
            case 'h': bOut[0] = 0xA0; bOut[1] = 0x01; break;
            case 'i': bOut[0] = 0xA4; bOut[1] = 0x01; break;
            case 'j': bOut[0] = 0xA8; bOut[1] = 0x01; break;
            case 'k': bOut[0] = 0xAC; bOut[1] = 0x01; break;
            case 'l': bOut[0] = 0xB0; bOut[1] = 0x01; break;
            case 'm': bOut[0] = 0xB4; bOut[1] = 0x01; break;
            case 'n': bOut[0] = 0xB8; bOut[1] = 0x01; break;
            case 'o': bOut[0] = 0xBC; bOut[1] = 0x01; break;
            case 'p': bOut[0] = 0xC0; bOut[1] = 0x01; break;
            case 'q': bOut[0] = 0xC4; bOut[1] = 0x01; break;
            case 'r': bOut[0] = 0xC8; bOut[1] = 0x01; break;
            case 's': bOut[0] = 0xCC; bOut[1] = 0x01; break;
            case 't': bOut[0] = 0xD0; bOut[1] = 0x01; break;
            case 'u': bOut[0] = 0xD4; bOut[1] = 0x01; break;
            case 'v': bOut[0] = 0xD8; bOut[1] = 0x01; break;
            case 'w': bOut[0] = 0xDC; bOut[1] = 0x01; break;
            case 'x': bOut[0] = 0xE0; bOut[1] = 0x01; break;
            case 'y': bOut[0] = 0xE4; bOut[1] = 0x01; break;
            case 'z': bOut[0] = 0xE8; bOut[1] = 0x01; break;


            case '}': bOut[0] = 0xF4; bOut[1] = 0x01; break;
            case '²': bOut[0] = 0xC8; bOut[1] = 0x02; break;
            case '³': bOut[0] = 0xCC; bOut[1] = 0x02; break;
            case '{': bOut[0] = 0xEC; bOut[1] = 0x01; break;
            case '[': bOut[0] = 0x6C; bOut[1] = 0x01; break;
            case ']': bOut[0] = 0x74; bOut[1] = 0x01; break;
            case '~': bOut[0] = 0xF8; bOut[1] = 0x01; break;
            case '\\': bOut[0] = 0x70; bOut[1] = 0x01; break;
            case '|': bOut[0] = 0xF0; bOut[1] = 0x01; break;
            case 'µ': bOut[0] = 0xD4; bOut[1] = 0x02; break;
            case '@': bOut[0] = 0x00; bOut[1] = 0x01; break;
            case '€': bOut[0] = 0x00; bOut[1] = 0x02; break;
            case '=': bOut[0] = 0xF4; bOut[1] = 0x00; break;
            case '!': bOut[0] = 0x84; bOut[1] = 0x00; break;
            case '"': bOut[0] = 0x88; bOut[1] = 0x00; break;
            case '§': bOut[0] = 0x9C; bOut[1] = 0x02; break;
            case '$': bOut[0] = 0x90; bOut[1] = 0x00; break;
            case '%': bOut[0] = 0x94; bOut[1] = 0x00; break;
            case '&': bOut[0] = 0x98; bOut[1] = 0x00; break;
            case '/': bOut[0] = 0xBC; bOut[1] = 0x00; break;
            case '(': bOut[0] = 0xA0; bOut[1] = 0x00; break;
            case ')': bOut[0] = 0xA4; bOut[1] = 0x00; break;
            case '*': bOut[0] = 0xA8; bOut[1] = 0x00; break;
            case ';': bOut[0] = 0xEC; bOut[1] = 0x00; break;
            case '_': bOut[0] = 0x7C; bOut[1] = 0x01; break;
            case ':': bOut[0] = 0xE8; bOut[1] = 0x00; break;
            case '\'': bOut[0] = 0x9C; bOut[1] = 0x00; break;
            case '?': bOut[0] = 0xFC; bOut[1] = 0x00; break;
            case '°': bOut[0] = 0xC0; bOut[1] = 0x02; break;
            case '`': bOut[0] = 0x80; bOut[1] = 0x01; break;
            case '>': bOut[0] = 0xF8; bOut[1] = 0x00; break;
            case '^': bOut[0] = 0x78; bOut[1] = 0x01; break;
            case '+': bOut[0] = 0xAC; bOut[1] = 0x00; break;
            case '-': bOut[0] = 0xB4; bOut[1] = 0x00; break;
            case ',': bOut[0] = 0xB0; bOut[1] = 0x00; break;
            case '.': bOut[0] = 0xB8; bOut[1] = 0x00; break;
            case '#': bOut[0] = 0x8C; bOut[1] = 0x00; break;
            case 'ß': bOut[0] = 0x7C; bOut[1] = 0x03; break;
            case '<': bOut[0] = 0xF0; bOut[1] = 0x00; break;


            default: bOut[0] = 0xFC; bOut[1] = 0x00; break;//'?'
            }
        }
Thanks for sharing. I think there's no need to explain, after see it a coder should understand... I don't cuz I don't know a lot of c++, just basic level
i think i already seen a something like that in Gellin base our another hack base here.
Quote Originally Posted by XarutoUsoCrack View Post
i think i already seen a something like that in Gellin base our another hack base here.
idk, didnt spend to much time on those base

Quote Originally Posted by B4NDiT26 View Post
Thanks for sharing. I think there's no need to explain, after see it a coder should understand... I don't cuz I don't know a lot of c++, just basic level
Ok, I will explain it then.
lol your doing the S2S better than even Doobic Studio's original S2S code XD
Quote Originally Posted by Relax1977 View Post
how to use it?
If you use a spammer, that is how you use it, there is an image of the code Right about.
Quote Originally Posted by topblast View Post


If you use a spammer, that is how you use it, there is an image of the code Right about.
i don't think you need to worry about blanking out your ID's because most have been released public. just sayin
Quote Originally Posted by supercarz1991 View Post
i don't think you need to worry about blanking out your ID's because most have been released public. just sayin
But not in direct images
Quote Originally Posted by topblast View Post


But not in direct images
that's what i was talking about was on your image lol
Quote Originally Posted by supercarz1991 View Post
that's what i was talking about was on your image lol
i meant people don't have the source in images posted online, its mostly in a file you have to download and extract
Quote Originally Posted by topblast View Post


i meant people don't have the source in images posted online, its mostly in a file you have to download and extract
oh that makes sense. never mind
Posts 112 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?