def gen_user_breadcrumb(size):
"""
Used in comments posting.
:param size:
:return:
"""
key = 'iN4$aGr0m'
dt = int(time.time() * 1000)
# typing time elapsed
time_elapsed = randint(500, 1500) + size * randint(500, 1500)
text_change_event_count = max(1, size / randint(3, 5))
data = '{size!s} {elapsed!s} {count!s} {dt!s}'.format(**{
'size': size, 'elapsed': time_elapsed, 'count': text_change_event_count, 'dt': dt
})
return '{0!s}\n{1!s}\n'.format(
base64.b64encode(hmac.new(key.encode('ascii'), data.encode('ascii'), digestmod=hashlib.sha256).digest()),
base64.b64encode(data.encode('ascii')))
评论列表
文章目录