Skip to content

Instantly share code, notes, and snippets.

@msm-code
Created October 21, 2016 09:53
Show Gist options
  • Select an option

  • Save msm-code/643ec00d421d3822cf61075ee4a780df to your computer and use it in GitHub Desktop.

Select an option

Save msm-code/643ec00d421d3822cf61075ee4a780df to your computer and use it in GitHub Desktop.
paper.cpp.9fe969957d8333124adfd59d98c59b29
void encrypted_memcpy(char *to, char *from, int len) {
if (is_in_encrypted_section(to)) {
if (is_in_encrypted_section(from)) {
memcpy(to, from, len);
} else {
memcpy_and_encrypt(to, from, len);
}
} else {
if (is_in_encrypted_section(from)) {
memcpy_and_decrypt(to, from, len);
} else {
memcpy(to, from, len);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment