summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/q.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/bin/q.py b/bin/q.py
index c259588..5760653 100755
--- a/bin/q.py
+++ b/bin/q.py
@@ -91,9 +91,7 @@ def sha(data,algorithm,encoding):
# For backward compatibility only (doesn't handle encoding well enough)
def sha1(data):
- if not isinstance(data,str) and not isinstance(data,unicode):
- return hashlib.sha1(str(data)).hexdigest()
- return hashlib.sha1(data).hexdigest()
+ return hashlib.sha1(six.text_type(data).encode('utf-8')).hexdigest()
# TODO Add caching of compiled regexps - Will be added after benchmarking capability is baked in
def regexp(regular_expression, data):