- sha_digest = hashlib.sha1('%s%s%s%s' % (
- randrange(0, MAX_SESSION_KEY), time.time(), unicode(seed).encode('utf-8', 'replace'), settings.SECRET_KEY)
- ).digest()
- return urlsafe_b64encode(sha_digest).replace('=', '').replace('_', '-').lower()
+ sha_digest = hashlib.sha1((
+ '%s%s%s%s' % (
+ randrange(0, MAX_SESSION_KEY),
+ time.time(),
+ str(seed).encode('utf-8', 'replace'),
+ settings.SECRET_KEY
+ )
+ ).encode('utf-8')).digest()
+ return urlsafe_b64encode(sha_digest).decode('latin1').replace('=', '').replace('_', '-').lower()