Skip to content

Instantly share code, notes, and snippets.

@hasherezade
Created March 7, 2018 18:54
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 hasherezade/781c18d902bbba023cef6a272c0b0624 to your computer and use it in GitHub Desktop.
Save hasherezade/781c18d902bbba023cef6a272c0b0624 to your computer and use it in GitHub Desktop.
void lockcrypt::level1_crypt(void *buf, size_t buf_size, void *key, size_t key_size)
{
size_t dwsize = buf_size >> 2;
for (size_t i = 4, k = 0; i < buf_size - 6; i += 2, k +=4) {
if (k > KEY_SIZE) {
k = 0;
}
DWORD *dwlist = (DWORD *) ((ULONGLONG)buf + i);
DWORD *keydw = (DWORD *) ((ULONGLONG)key + k);
DWORD inp = *dwlist;
DWORD out = inp ^ (*keydw);
(*dwlist) = out;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment