Skip to content

Commit

Permalink
In python 3 unicode strings don't auto coerce to bytes.
Browse files Browse the repository at this point in the history
We have to explictily pass byte objects to hashing functions because
that's what the want to hash.
  • Loading branch information
feanil committed Sep 19, 2019
1 parent a179233 commit 79fc35b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
from __future__ import absolute_import

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '2.0.8'
__version__ = '2.0.9'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
4 changes: 2 additions & 2 deletions edx_proctoring/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ def obscured_user_id(user_id, *extra):
Any extra information can be added to the hash
"""
obs_hash = hmac.new(settings.SECRET_KEY.encode('ascii'), digestmod=hashlib.sha1)
obs_hash.update(six.text_type(user_id))
obs_hash.update(u''.join(six.text_type(ext) for ext in extra))
obs_hash.update(user_id.encode('utf-8'))
obs_hash.update(b''.join(ext.encode('utf-8') for ext in extra))
return obs_hash.hexdigest()


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@edx/edx-proctoring",
"//": "Be sure to update the version number in edx_proctoring/__init__.py",
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.",
"version": "2.0.8",
"version": "2.0.9",
"main": "edx_proctoring/static/index.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit 79fc35b

Please sign in to comment.