Add set 1 readme, misc. makefile changes
This commit is contained in:
parent
5e51d25c8a
commit
d85d53bb13
|
@ -1,3 +1,5 @@
|
||||||
# general ignore patterns
|
# general ignore patterns
|
||||||
*/bin/*
|
*/bin/*
|
||||||
|
|
||||||
|
# set 1 ignores
|
||||||
|
set1/aes-libs/*
|
||||||
|
|
|
@ -2,16 +2,30 @@ CC = gcc
|
||||||
CFLAGS = -Wall -Wpedantic -Wextra -std=c99 -fstack-protector-all \
|
CFLAGS = -Wall -Wpedantic -Wextra -std=c99 -fstack-protector-all \
|
||||||
-fdiagnostics-color=auto
|
-fdiagnostics-color=auto
|
||||||
DEBUG = -0g -ggdb
|
DEBUG = -0g -ggdb
|
||||||
LINK =
|
LINK =
|
||||||
|
LIB_INC =
|
||||||
SRC_DIR = src
|
SRC_DIR = src
|
||||||
OUT_DIR = bin
|
OUT_DIR = bin
|
||||||
TARGETS = base64 fixed-xor char-freq-analize
|
TARGETS = base64 fixed-xor char-freq-analyze repeating-key-xor aes-ecb
|
||||||
|
|
||||||
|
|
||||||
all: $(TARGETS)
|
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
|
%: $(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:
|
clean:
|
||||||
$(RM) *.o $(OUT_DIR)/*
|
$(RM) *.o $(OUT_DIR)/*
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ int main()
|
||||||
|
|
||||||
for (i = 0; i < sizeof(byte_freq); ++i) {
|
for (i = 0; i < sizeof(byte_freq); ++i) {
|
||||||
if (byte_freq[i] != 0) {
|
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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue