summaryrefslogtreecommitdiff
path: root/fixed_xor_s1.c
blob: 44a644748334b2878efc7d86cc011bc3b88e1c9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// https://cryptopals.com/sets/1/challenges/2
#include "util/xor.h"
#include <string.h>

int main() {
  char *str = "1c0111001f010100061a024b53535009181c";
  char *cmp = "686974207468652062756c6c277320657965";
  char *actual = xor_hex(str, cmp);
  char *expect = "746865206b696420646f6e277420706c6179";
  if (strcmp(actual, expect) != 0) {
    printf("does not match!!!\n"
           "expected: %s\n"
           "received: %s\n",
           expect, actual);
    return 1;
  } else
    printf("passed :^)\n");
  return 0;
}