Skip to content

Instantly share code, notes, and snippets.

@ioncodes
Last active September 2, 2018 20:01
Show Gist options
  • Save ioncodes/ec791f37c41ca39ee46d053be3db8590 to your computer and use it in GitHub Desktop.
Save ioncodes/ec791f37c41ca39ee46d053be3db8590 to your computer and use it in GitHub Desktop.
xor two strings in c
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#define LENGTH 5
void xor(char const value1[LENGTH], char const value2[LENGTH], char *xored[LENGTH]) {
for(int i=0; i<LENGTH; ++i) {
xored[i] = (char)(value1[i] ^ value2[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment