[Python-modules-commits] [python-pyld] 101/276: Use utf-8 encoding w/hashlib where necessary. Closes #15.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:47:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-pyld.

commit f3432c7c863d73621c2b0fc5fcd33d7c13669953
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Mon Nov 26 11:23:38 2012 -0500

    Use utf-8 encoding w/hashlib where necessary. Closes #15.
    
    - Thanks to justjulian.
---
 lib/pyld/jsonld.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index 897d432..3a31baa 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -1916,7 +1916,7 @@ class JsonLdProcessor:
         nquads.sort()
         # return hashed quads
         md = hashlib.sha1()
-        md.update(''.join(nquads))
+        md.update(''.join(nquads).encode('utf-8'))
         hash = bnodes[id]['hash'] = md.hexdigest()
         return hash
 
@@ -1962,8 +1962,9 @@ class JsonLdProcessor:
                 # hash direction, property, and bnode name/hash
                 group_md = hashlib.sha1()
                 group_md.update(direction)
-                group_md.update(statement['property']['nominalValue'])
-                group_md.update(name)
+                group_md.update(
+                    statement['property']['nominalValue'].encode('utf-8'))
+                group_md.update(name.encode('utf-8'))
                 group_hash = group_md.hexdigest()
 
                 # add bnode to hash group
@@ -2025,7 +2026,7 @@ class JsonLdProcessor:
                     chosen_namer = path_namer_copy
 
             # digest chosen path and update namer
-            md.update(chosen_path)
+            md.update(chosen_path.encode('utf-8'))
             path_namer = chosen_namer
 
         # return SHA-1 hash and path namer

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git



More information about the Python-modules-commits mailing list