Add set 1 readme, misc. makefile changes

This commit is contained in:
Horseshoe Crab 2022-04-27 01:07:07 -07:00
parent 5e51d25c8a
commit d85d53bb13
4 changed files with 48 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
# general ignore patterns
*/bin/*
# set 1 ignores
set1/aes-libs/*

View File

@ -3,15 +3,29 @@ CFLAGS = -Wall -Wpedantic -Wextra -std=c99 -fstack-protector-all \
-fdiagnostics-color=auto
DEBUG = -0g -ggdb
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)/*

28
set1/README.md Normal file
View File

@ -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

View File

@ -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]);
}
}