Skip to content

Instantly share code, notes, and snippets.

@nyux
Created August 14, 2014 13:55
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 nyux/3f51c7840ce8bdf111d4 to your computer and use it in GitHub Desktop.
Save nyux/3f51c7840ce8bdf111d4 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
/* remember: compile with -lgmp flag */
int main(void)
{
char *hex1 = "1c0111001f010100061a024b53535009181c";
char *hex2 = "686974207468652062756c6c277320657965";
mpz_t hexval1, hexval2, result;
mpz_init_set_str(hexval1, hex1, 16);
mpz_init_set_str(hexval2, hex2, 16);
mpz_init(result);
mpz_xor(result, hexval1, hexval2);
gmp_printf("%Zx\n", result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment