From f2742b5eac413f73264d89051fe47f8cc65f256b Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Wed, 9 Aug 2017 11:03:06 +0530 Subject: [PATCH] Encode string before passing to hashlib.sha224 --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index a4c721c8ab..c3d5d1aacd 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -576,7 +576,7 @@ def generate_hash(txt=None, length=None): """Generates random hash for given text + current timestamp + random string.""" import hashlib, time from .utils import random_string - digest = hashlib.sha224((txt or "") + repr(time.time()) + repr(random_string(8))).hexdigest() + digest = hashlib.sha224(((txt or "") + repr(time.time()) + repr(random_string(8))).encode()).hexdigest() if length: digest = digest[:length] return digest