Also implement fixed-xor bruteforcer

This commit is contained in:
Horseshoe Crab 2022-04-27 01:08:57 -07:00
parent d85d53bb13
commit 08b7de53f2
2 changed files with 28 additions and 1 deletions

View File

@ -20,7 +20,6 @@ EXT_INCLUDES = -Iaes-libs/tiny-AES-c
#EXT_LIBS = -Laes-libs/tiny-AES-c #EXT_LIBS = -Laes-libs/tiny-AES-c
#LDLIBS = -laes #LDLIBS = -laes
#%: $(SRC_DIR)/%.c
%: $(SRC_DIR)/%.c %: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $(OUT_DIR)/$@ $< $(CC) $(CFLAGS) -o $(OUT_DIR)/$@ $<

View File

@ -0,0 +1,28 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
uint8_t i = 0;
size_t k;
int8_t ciphertext[] = "\x1b\x37\x37\x33\x31\x36\x3f\x78\x15\x1b\x7f\x2b"
"\x78\x34\x31\x33\x3d\x78\x39\x78\x28\x37\x2d\x36"
"\x3c\x78\x37\x3e\x78\x3a\x39\x3b\x37\x36";
int8_t attempt[sizeof(ciphertext) - 1];
do {
printf("i = %d\n", i);
for (k = 0; k < sizeof(attempt); ++k) {
attempt[k] = ciphertext[k] ^ i;
}
for (k = 0; k < sizeof(attempt); ++k) {
putchar(attempt[k]);
}
putchar('\n');
++i;
} while (i < 255);
return EXIT_SUCCESS;
}