From 1eadfac7404d34bba2f2d928f99acdaf75c3f049 Mon Sep 17 00:00:00 2001 From: Yuanyue Li Date: Mon, 2 Oct 2023 16:03:57 -0700 Subject: [PATCH] Change the way to generate hash. --- backend/entropy_search.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/entropy_search.py b/backend/entropy_search.py index 55938f7..1567edb 100644 --- a/backend/entropy_search.py +++ b/backend/entropy_search.py @@ -4,6 +4,8 @@ import numpy as np import base64 import pickle +import hashlib + from ms_entropy import FlashEntropySearch, read_one_spectrum, standardize_spectrum import multiprocessing as mp import copy @@ -307,10 +309,10 @@ def load_spectral_library(self, file_library) -> None: def _build_spectral_library(self, file_library): # Calculate hash of file_library - index_hash = base64.b64encode(json.dumps({ + index_hash = hashlib.md5(json.dumps({ "ms2_tolerance_in_da": self.ms2_tolerance_in_da, "version": "1.1.0" - }).encode()).decode()[:6] + }).encode()).hexdigest()[:6] # Check if the library is already indexed if file_library.suffix == ".esi":