From 2c3bfdfd3a10066ec5726b8d5631ab7b9f83a725 Mon Sep 17 00:00:00 2001 From: derrod Date: Sat, 9 May 2020 11:03:14 +0200 Subject: [PATCH] [models] Use random GUID when creating Chunk() --- legendary/models/chunk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/legendary/models/chunk.py b/legendary/models/chunk.py index 7229be4..6e9fbd8 100644 --- a/legendary/models/chunk.py +++ b/legendary/models/chunk.py @@ -6,6 +6,7 @@ import zlib from hashlib import sha1 from io import BytesIO +from uuid import uuid4 from legendary.utils.rolling_hash import get_hash @@ -20,7 +21,7 @@ class Chunk: self.compressed_size = 0 self.hash = 0 self.stored_as = 0 - self.guid = [] + self.guid = struct.unpack('>IIII', uuid4().bytes) # 0x1 = rolling hash, 0x2 = sha hash, 0x3 = both self.hash_type = 0