diff --git a/.gitignore b/.gitignore index 1530978..f4bf0b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.o \ No newline at end of file +*.o +.vscode/settings.json diff --git a/Makefile b/Makefile index 0c4f84c..dbe1f04 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,25 @@ CFLAGS = -Wall -O3 -fsigned-char $(CPU_FLAGS) $(STATIC_CFLAGS) -std=c++14 CLINK = -lm $(STATIC_LFLAGS) -O3 -std=c++14 PY_KMC_API_CFLAGS = $(PY_FLAGS) -Wall -shared -std=c++14 -O3 + +# Find OpenSSL path using "which" +OPENSSL_PATH := $(shell which openssl) + +# if open ssl is not found, then exit +ifeq ($(OPENSSL_PATH),) +$(error "OpenSSL not found. Please install OpenSSL") +endif + +# Extract directory path from the full path +OPENSSL_DIR := $(dir $(OPENSSL_PATH)) + +# Set flags using the directory path +CFLAGS += -I$(OPENSSL_DIR)/../include -lssl -lcrypto +LDFLAGS += -L$(OPENSSL_DIR)/../lib -lssl -lcrypto + +# export LD_LIBRARY_PATH appropriately +export LD_LIBRARY_PATH := $(OPENSSL_DIR)/../lib:$(LD_LIBRARY_PATH) + KMC_CLI_OBJS = \ $(KMC_CLI_DIR)/kmc.o @@ -173,7 +192,7 @@ frackmc: $(KMC_CLI_OBJS) $(LIB_KMC_CORE) $(LIB_ZLIB) frackmcdump: $(KMC_DUMP_OBJS) $(KMC_API_OBJS) -mkdir -p $(OUT_BIN_DIR) - $(CC) $(CLINK) -o $(OUT_BIN_DIR)/$@ $^ + $(CC) $(CLINK) -o $(OUT_BIN_DIR)/$@ $^ -lssl -lcrypto # frac_kmc: g++ -Wall -O3 wrappers/sketch/frac_kmc_sketch.cpp -o fracKmcSketch fracKmcSketch: wrappers/sketch/frac_kmc_sketch.cpp diff --git a/kmc_dump/kmc_dump.cpp b/kmc_dump/kmc_dump.cpp index 4eae803..da7e567 100644 --- a/kmc_dump/kmc_dump.cpp +++ b/kmc_dump/kmc_dump.cpp @@ -22,6 +22,9 @@ #include "../kmc_api/kmc_file.h" #include "nc_utils.h" #include +#include +#include +#include using namespace std; @@ -357,7 +360,30 @@ int main(int argc, char* argv[]) } - output_string = "], \"molecule\":\"dna\", \"md5sum\":\"abcd\"}], \"version\":0.1}]\n"; + + // compute md5sum + MD5_CTX md5_ctx; + MD5_Init(&md5_ctx); + // add ksize to md5sum + string ksize_str = to_string(ksize); + MD5_Update(&md5_ctx, ksize_str.c_str(), ksize_str.length()); + // add the hashes to md5sum + for (int i=0; i