-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathgenerate_hashes.py
More file actions
54 lines (46 loc) · 1.46 KB
/
generate_hashes.py
File metadata and controls
54 lines (46 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
import hashlib
import os
def calculate_sha256(file_path):
sha256_hash = hashlib.sha256()
try:
with open(file_path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
sha256_hash.update(chunk)
return sha256_hash.hexdigest()
except FileNotFoundError:
return None
def main():
files_to_hash = [
"dist/android-bloatware-remover.exe",
"dist/android-bloatware-remover"
]
print("# File Verification Hashes")
print()
print("Use these SHA256 hashes to verify file integrity:")
print()
for file_path in files_to_hash:
if os.path.exists(file_path):
hash_value = calculate_sha256(file_path)
file_size = os.path.getsize(file_path)
print(f"**{os.path.basename(file_path)}**")
print(f"- SHA256: `{hash_value}`")
print(f"- Size: {file_size:,} bytes")
print()
else:
print(f"File not found: {file_path}")
print("## How to verify:")
print()
print("**Windows (PowerShell):**")
print("```powershell")
print("Get-FileHash -Algorithm SHA256 android-bloatware-remover-windows.exe")
print("```")
print()
print("**Linux/Mac:**")
print("```bash")
print("sha256sum android-bloatware-remover-linux")
print("# or")
print("shasum -a 256 android-bloatware-remover-macos")
print("```")
if __name__ == "__main__":
main()