diff options
author | Teddy <[email protected]> | 2013-09-01 11:41:56 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-09-01 11:41:56 +0800 |
commit | d3c6b23cfade2cc91b45dda5eb62e8a7d2398a18 (patch) | |
tree | e80b25ff89eb81b0abb61434fa493d441109a5f7 /server | |
parent | 5ebd9d005355d97eaa89c7b86afd80c32cdafd5c (diff) |
add timestamp to fingerprint
Diffstat (limited to 'server')
-rw-r--r-- | server/piztor/server.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/piztor/server.py b/server/piztor/server.py index a4f5d69..2b6acb0 100644 --- a/server/piztor/server.py +++ b/server/piztor/server.py @@ -8,6 +8,7 @@ from sqlalchemy.orm import sessionmaker from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound from collections import deque +from time import time import struct import os @@ -75,7 +76,7 @@ class _StatusCode: class PushData(object): from hashlib import sha256 def pack(self, optcode, data): - self.finger_print = sha256(data).digest() + self.finger_print = sha256(data + struct.pack("!d", time())).digest() buff = struct.pack("!B32s", optcode, self.finger_print) buff += data buff = struct.pack("!L", _SectionSize.LENGTH + len(buff)) + buff |