From d3c6b23cfade2cc91b45dda5eb62e8a7d2398a18 Mon Sep 17 00:00:00 2001 From: Teddy Date: Sun, 1 Sep 2013 11:41:56 +0800 Subject: add timestamp to fingerprint --- server/piztor/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server') 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 -- cgit v1.2.3-70-g09d2