Fix byte encoding of Grades hashes

This commit is contained in:
Nimisha Asthagiri
2019-08-19 11:42:36 -04:00
parent 7c8d9dd422
commit 1951d2eab8
2 changed files with 2 additions and 2 deletions

View File

@@ -79,7 +79,7 @@ class BlockRecordList(object):
supported by adding a label indicated which algorithm was used, e.g.,
"sha256$j0NDRmSPa5bfid2pAcUXaxCm2Dlh3TwayItZstwyeqQ=".
"""
return b64encode(sha1(self.json_value).digest())
return b64encode(sha1(self.json_value.encode('utf-8')).digest())
@lazy
def json_value(self):

View File

@@ -93,7 +93,7 @@ class GradesTransformer(BlockStructureTransformer):
separators=(',', ':'), # Remove spaces from separators for more compact representation
sort_keys=True,
)
return b64encode(sha1(ordered_policy).digest())
return b64encode(sha1(ordered_policy.encode('utf-8')).digest())
@classmethod
def _collect_explicit_graded(cls, block_structure):