forked from LBRYCommunity/lbry-sdk
switched from sha256 for unencrypted file hash to sha384
This commit is contained in:
parent
b8325c1f89
commit
aeaa7ba986
1 changed files with 6 additions and 6 deletions
|
@ -22,12 +22,12 @@ from lbrynet.schema.types.v2.claim_pb2 import (
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def calculate_sha256_file_hash(file_path):
|
def calculate_sha384_file_hash(file_path):
|
||||||
sha256 = hashlib.sha256()
|
sha384 = hashlib.sha384()
|
||||||
with open(file_path, 'rb') as f:
|
with open(file_path, 'rb') as f:
|
||||||
for chunk in iter(lambda: f.read(128 * sha256.block_size), b''):
|
for chunk in iter(lambda: f.read(128 * sha384.block_size), b''):
|
||||||
sha256.update(chunk)
|
sha384.update(chunk)
|
||||||
return sha256.digest()
|
return sha384.digest()
|
||||||
|
|
||||||
|
|
||||||
class Dimmensional(Metadata):
|
class Dimmensional(Metadata):
|
||||||
|
@ -130,7 +130,7 @@ class Source(Metadata):
|
||||||
self.size = os.path.getsize(file_path)
|
self.size = os.path.getsize(file_path)
|
||||||
if self.size == 0:
|
if self.size == 0:
|
||||||
raise Exception(f"Cannot publish empty file: {file_path}")
|
raise Exception(f"Cannot publish empty file: {file_path}")
|
||||||
self.file_hash_bytes = calculate_sha256_file_hash(file_path)
|
self.file_hash_bytes = calculate_sha384_file_hash(file_path)
|
||||||
return stream_type
|
return stream_type
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in a new issue