diff --git a/.gitignore b/.gitignore index 356f27e..e45ea04 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ # general ignore patterns */bin/* +# set 1 ignores +set1/aes-libs/* diff --git a/set1/Makefile b/set1/Makefile index 32e47b9..cc27bd7 100644 --- a/set1/Makefile +++ b/set1/Makefile @@ -2,16 +2,30 @@ CC = gcc CFLAGS = -Wall -Wpedantic -Wextra -std=c99 -fstack-protector-all \ -fdiagnostics-color=auto DEBUG = -0g -ggdb -LINK = +LINK = +LIB_INC = SRC_DIR = src OUT_DIR = bin -TARGETS = base64 fixed-xor char-freq-analize +TARGETS = base64 fixed-xor char-freq-analyze repeating-key-xor aes-ecb all: $(TARGETS) +# TODO toggle mbedtls or tiny-AES-c +#EXT_INCLUDES = -Iaes-libs/mbedtls/include/ +#EXT_LIBS = -Laes-libs/mbedtls/library +#LDLIBS = -lmbedcrypto +# +EXT_INCLUDES = -Iaes-libs/tiny-AES-c +#EXT_LIBS = -Laes-libs/tiny-AES-c +#LDLIBS = -laes + +#%: $(SRC_DIR)/%.c %: $(SRC_DIR)/%.c - $(CC) $(CFLAGS) $(LINK) $< -o $(OUT_DIR)/$@ + $(CC) $(CFLAGS) -o $(OUT_DIR)/$@ $< + +aes-ecb: $(SRC_DIR)/aes-ecb.c + $(CC) $(CFLAGS) $(EXT_INCLUDES) $(EXT_LIBS) -o $(OUT_DIR)/$@ $< $(LDLIBS) clean: $(RM) *.o $(OUT_DIR)/* diff --git a/set1/README.md b/set1/README.md new file mode 100644 index 0000000..debfe6b --- /dev/null +++ b/set1/README.md @@ -0,0 +1,28 @@ +# Set 1 + +Note: may need to `pip install jinja2` in order to `make` mbedtls + +### Challenge 1: Convert hex to base64 +Provided by base64.c + +### Challenge 2: Fixed XOR +Provided by fixed-key-xor.c + +### Challenge 3: Single-byte XOR cipher +Provided by ch3-brute-force.c and char-freq-analyze.c + +### Challenge 4: Detect single-character XOR + + +### Challenge 5: Implement repeating-key XOR +Provided by repeating-key-xor.c + +### Challenge 6: Break repeating-key XOR + + +### Challenge 7: AES in ECB mode + + +### Challenge 8: Detect AES in ECB mode + + diff --git a/set1/src/char-freq-analyze.c b/set1/src/char-freq-analyze.c index 2aa7a8e..98cf44a 100644 --- a/set1/src/char-freq-analyze.c +++ b/set1/src/char-freq-analyze.c @@ -19,7 +19,7 @@ int main() for (i = 0; i < sizeof(byte_freq); ++i) { if (byte_freq[i] != 0) { - printf("%x occurs %d times\n", i, byte_freq[i]); + printf("%lx occurs %d times\n", i, byte_freq[i]); } }