#
#
# MDcrack Makefile
#
# Gregory Duchemin, 11 Feb 2001
# c3rb3r@hotmail.com
#
# MDcrack is derived from the RSA Data
# Security, Inc. MD5 Message-Digest Algorithm
#

CC = gcc

# Please set RESUME_FILE and choose a secure place for the resume file 
# before using mdcrack as root.
# default is NOT secure and own an obvious race condition.
# Nevertheless Mdcrack offer a protection against symlink attack style and will not create a resume file across a pre existing symlink.

# BENCH_HASH corresponds to the default benchmark hash 
# In fact i did not try it no more longer than 10 secs, however if 
# it would collide too quickly for your tests, change it.
 
# ALFA is the default charset string used to design passwords. 
# We can still use a customized one with -s option on the command line.

MDCRACK_OPTS=  -DRESUME_FILE="\"/tmp/.mdcrack-resume\"" -DBENCH_HASH="\"ffffffffffffffffffffffffffffffff\"" -DALFA="\"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\""

# INF64 will determine if the designed passwords can be larger than a single 
# MD5 block, this value include naturaly eventual randomizer string.
# Performance are affected if u decide to try larger passwords that don't
# fit into 64bits block.


MDFLAGS= -DINF64=1


# Uncomment the line below on BIG ENDIAN architectures else no crack would be possible.

MDARCH= 
#MDARCH= -DISBIG_ENDIAN=1


# BLOCKSIZE in Mo is used for file bufferization. The input file is read block by block in memory, set the value as high as possible accordingly to your system size.

BLOCK=-DBLOCKSIZE=50


CFLAGS = -O3 -fforce-addr -funroll-loops 

# static linkage will suppress a little overhead due to obj search/mountage.
# useless for big sessions.

LDFLAGS = -static

mdcrack: md5c.o mdcrack.o stats.o errors.o
	$(CC) $(LDFLAGS) -o mdcrack md5c.o mdcrack.o stats.o errors.o
	@echo -e "\nok.\n\nto install -- \"make install\"\nto test -- \"make test/bigtest\"\n"

mdcrack.o: generic.h mdcrack.c 
	$(CC) -c $(CFLAGS) $(MDCRACK_OPTS) $(MDARCH) $(BLOCK) mdcrack.c

md5c.o: generic.h md5c.c
	$(CC) -c $(MDFLAGS) $(CFLAGS) $(MDARCH) md5c.c


stats.o: generic.h stats.c
	$(CC) -c $(MDFLAGS) $(CFLAGS) $(MDARCH) stats.c

errors.o: generic.h errors.c
	$(CC) -c $(MDFLAGS) $(CFLAGS) $(MDARCH) errors.c

test: mdcrack 
	./mdcrack -s 0123456ABCDEFGHIJabcdfghzxsqwertiop   f71dbe52628a3f83a77ab494817525c6

bigtest: mdcrack
	./mdcrack  f71dbe52628a3f83a77ab494817525c6

clean:
	@echo -e "\nCleaning binaries...\n"
	rm -f *.o mdcrack 

install:
	@echo -e "\nInstalling mdcrack in /usr/sbin/mdcrack\n"
	cp ./mdcrack /usr/sbin/mdcrack
	@echo -e "\nok.\n"

