From 8440ff8d93b96ee78181e3382462e8e0901a3f40 Mon Sep 17 00:00:00 2001 From: Shreenidhi Shedi Date: Sat, 12 Aug 2023 12:16:31 +0530 Subject: [PATCH] Use fips compatible algorithm Signed-off-by: Shreenidhi Shedi --- js2py/evaljs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js2py/evaljs.py b/js2py/evaljs.py index f4649c4..b310a9d 100644 --- a/js2py/evaljs.py +++ b/js2py/evaljs.py @@ -188,7 +188,7 @@ class EvalJs(object): cache = self.__dict__['cache'] except KeyError: cache = self.__dict__['cache'] = {} - hashkey = hashlib.md5(js.encode('utf-8')).digest() + hashkey = hashlib.sha512(js.encode('utf-8')).digest() try: compiled = cache[hashkey] except KeyError: @@ -211,7 +211,7 @@ class EvalJs(object): """ code = translate_js(js, '') # make sure you have a temp folder: - filename = 'temp' + os.sep + '_' + hashlib.md5( + filename = 'temp' + os.sep + '_' + hashlib.sha512( code.encode("utf-8")).hexdigest() + '.py' try: with open(filename, mode='w') as f: -- 2.25.1