Skip to content

Instantly share code, notes, and snippets.

@secrary
Created August 28, 2017 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secrary/5e5087ae36192a2415311991c5fec094 to your computer and use it in GitHub Desktop.
Save secrary/5e5087ae36192a2415311991c5fec094 to your computer and use it in GitHub Desktop.
u_char al, cl;
do {
key[0] = 0x20 + rand() % (0x7F - 0x20);
al = key[0];
u_char bl = al; // key[0]
cl = bl; // key[0]
DWORD ebx = (DWORD)bl << 4;
al &= 0xF;
DWORD ecx = (DWORD)cl >> 4;
cl = ecx & 0xF;
} while (al == cl); // e.g "(0x22), 3(0x33), D(0x44), U(0x55), f(0x66), w(0x77)
key[1] = (key[0] << 4) | ((key[0] >> 4) & 0xF); // e.g. 0x46 >>> 0x64
key[2] = key[0] + key[1];
key[3] = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment