mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-27 07:39:53 +08:00
Merge pull request #6772 from vladmandic/sha-calc-optimization
increase block size
This commit is contained in:
commit
ce13ced5dc
@ -34,9 +34,10 @@ def cache(subsection):
|
|||||||
|
|
||||||
def calculate_sha256(filename):
|
def calculate_sha256(filename):
|
||||||
hash_sha256 = hashlib.sha256()
|
hash_sha256 = hashlib.sha256()
|
||||||
|
blksize = 1024 * 1024
|
||||||
|
|
||||||
with open(filename, "rb") as f:
|
with open(filename, "rb") as f:
|
||||||
for chunk in iter(lambda: f.read(4096), b""):
|
for chunk in iter(lambda: f.read(blksize), b""):
|
||||||
hash_sha256.update(chunk)
|
hash_sha256.update(chunk)
|
||||||
|
|
||||||
return hash_sha256.hexdigest()
|
return hash_sha256.hexdigest()
|
||||||
|
Loading…
Reference in New Issue
Block a user