1# Brute force collision tester for 64-bit hashes 2# Part of xxHash project 3# Copyright (C) 2019-2020 Yann Collet 4# 5# GPL v2 License 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License along 18# with this program; if not, write to the Free Software Foundation, Inc., 19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21# You can contact the author at: 22# - xxHash homepage: https://www.xxhash.com 23# - xxHash source repository: https://github.com/Cyan4973/xxHash 24# 25 26SRC_DIRS = ./ ../../ allcodecs/ 27VPATH = $(SRC_DIRS) 28CPPFLAGS += $(addprefix -I ,$(SRC_DIRS)) 29CFLAGS ?= -std=c99 \ 30 -Wall -Wextra -Wconversion 31CXXFLAGS ?= -Wall -Wextra -Wconversion -std=c++11 32LDFLAGS += -pthread 33TESTHASHES = 110000000 34 35HASH_SRC := $(sort $(wildcard allcodecs/*.c allcodecs/*.cc)) 36HASH_OBJ := $(patsubst %.c,%.o,$(HASH_SRC)) 37 38 39.PHONY: default 40default: release 41 42.PHONY: all 43all: release 44 45collisionsTest: main.o pool.o threading.o sort.o $(HASH_OBJ) 46 $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ $(LDFLAGS) -o $@ 47 48main.o: hashes.h xxhash.h 49 50release: CXXFLAGS += -O3 51release: CFLAGS += -O3 52release: collisionsTest 53 54debug: CXXFLAGS += -g3 -O0 -DDEBUG 55debug: CFLAGS += -g3 -O0 -DDEBUG 56debug: collisionsTest 57 58.PHONY: check 59check: test 60 61.PHONY: test 62test: debug 63 @echo "" 64 @echo "## $(TESTHASHES) hashes with original and 0 threads" 65 @time ./collisionsTest --nbh=$(TESTHASHES) 66 @echo "" 67 @echo "## $(TESTHASHES) hashes with original and 4 threads" 68 @time ./collisionsTest --nbh=$(TESTHASHES) --threadlog=2 69 @echo "" 70 71.PHONY: clean 72clean: 73 $(RM) *.o allcodecs/*.o 74 $(RM) collisionsTest 75