X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/04cb9d727764da3c0d3ba30783ba25dc828e3899..82c3d8f89fa9f58afed6a8373add3da116a6fce1:/apps/catalogue/utils.py?ds=sidebyside diff --git a/apps/catalogue/utils.py b/apps/catalogue/utils.py index 72b097392..e44b3792f 100644 --- a/apps/catalogue/utils.py +++ b/apps/catalogue/utils.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# import random import time from base64 import urlsafe_b64encode @@ -16,7 +19,7 @@ MAX_SESSION_KEY = 18446744073709551616L # 2 << 63 def get_random_hash(seed): - sha_digest = sha_constructor('%s%s%s%s' % + sha_digest = sha_constructor('%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()