Encode to utf-8 before hashing.

This commit is contained in:
Adam Coddington 2013-10-11 18:29:15 -07:00
parent af9f53eca6
commit 565146ac3d

View file

@ -64,8 +64,13 @@ class PyiCloudService(object):
if 'dsInfo' in resp: if 'dsInfo' in resp:
dsid = resp['dsInfo']['dsid'] dsid = resp['dsInfo']['dsid']
self.params.update({'dsid': dsid}) self.params.update({'dsid': dsid})
instance = resp.get('instance', uuid.uuid4().hex) instance = resp.get(
sha = hashlib.sha1(self.user.get('apple_id') + instance) 'instance',
uuid.uuid4().hex.encode('utf-8')
)
sha = hashlib.sha1(
self.user.get('apple_id').encode('utf-8') + instance
)
self.params.update({'id': sha.hexdigest().upper()}) self.params.update({'id': sha.hexdigest().upper()})
def authenticate(self): def authenticate(self):