cryptopals_c

cryptopals crypto challenges solutions in pure c
git clone git://git.superpozycja.net/cryptopals_c
Log | Files | Refs | README

commit ebd62e982ee37128d8ddbd85b3c1fca17b209106
parent d59e0ba78af694145bd37963e8ee7397182d7080
Author: anna <anna@brokenlove.online>
Date:   Sun, 24 Mar 2024 00:11:35 +0100

chall 2

Diffstat:
Ms1/build.sh | 4+++-
As1/c2.c | 20++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/s1/build.sh b/s1/build.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/bin/zsh + +source ~/.zshrc for filename in *.c; do echo "compiling $filename" diff --git a/s1/c2.c b/s1/c2.c @@ -0,0 +1,20 @@ +#include <ba/ba.h> /* see my tools repo for this */ + +int main(int argc, char* argv[]) { + if(argc != 3) { + return -1; + } + ba* a; + ba* b; + a = ba_from_hex(argv[1]); + b = ba_from_hex(argv[2]); + if(a == NULL || b == NULL) { + return -1; + } + ba_xor(a, b); + ba_fprint(a, stdout, 0); + printf("\n"); + ba_free(a); + ba_free(b); + return 0; +}