Skip to content

Commit

Permalink
Change the way to generate hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanyueLi committed Oct 2, 2023
1 parent 99be71f commit 1eadfac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/entropy_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit 1eadfac

Please sign in to comment.