import hashlib | |
みはりhash = "F0B3321134" | |
# SHA256ハッシュ値計算の関数を登録 | |
def calculate_sha256(file_path): | |
sha256 = hashlib.sha256() | |
with open(file_path, "rb") as f: | |
while True: | |
data = f.read(4096) # ファイルを4096バイトずつ読み込む | |
if not data: | |
break | |
sha256.update(data) | |
return sha256.hexdigest().upper()[:10] | |
DLhash = calculate_sha256("oyama-mihari_ver2_onimai_PONY_last.safetensors") | |
print(f"\nDLしたファイルのハッシュ値: {DLhash}\nみはりLoraのハッシュ値: {みはりhash}\n") | |
if DLhash==みはりhash: | |
print("ハッシュ値が一致しました。ファイルは正常です") | |
else: | |
print("ハッシュ値が一致しません。ファイルが異常があります。") | |
input() |