Skip to content

Instantly share code, notes, and snippets.

@voronkovich
Created March 22, 2019 15:21
Show Gist options
  • Save voronkovich/2fbe36a897e7c0704f3b261efdad914d to your computer and use it in GitHub Desktop.
Save voronkovich/2fbe36a897e7c0704f3b261efdad914d to your computer and use it in GitHub Desktop.
#include <stddef.h>
#include "xor.h"
void *memxor(void *s, size_t ssize, void *k, size_t ksize)
{
unsigned char *sp = s;
unsigned char *kp = k;
for (size_t i = 0; i < ssize; ++i) {
sp[i] ^= kp[i % ksize];
}
return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment