Skip to content

Instantly share code, notes, and snippets.

@secrary
Created August 28, 2017 14:08
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/c1983ef930d71d894025acd35c911b2d to your computer and use it in GitHub Desktop.
Save secrary/c1983ef930d71d894025acd35c911b2d to your computer and use it in GitHub Desktop.
u_char middle_[17]{};
u_char org_middle_[17]{};
// Generate randomly
for (size_t i = 0; i < 17; i++)
{
middle_[i] = 0x20 + rand() % (0x7F - 0x20);
}
std::copy(std::begin(middle_), std::end(middle_), org_middle_);
u_char last_[17]{};
// loop_1
__asm {
lea esi, middle_;
mov ecx, 13;
loop_1:
lodsd;
xor eax, 0x1BADC0DE;
bswap eax;
not al;
rol eax, cl;
inc ecx;
bswap eax;
ror eax, cl;
dec ecx;
not eax;
xor eax, 0x98765432;
xchg al, ah;
mov [esi - 4], eax;
sub esi, 3;
loop loop_1;
}
// loop_2
for (size_t i = 0; i < 16; i++)
{
middle_[i] ^= key[2];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment