Nicer output for binsum.py.
This commit is contained in:
parent
818f63a658
commit
121522ced7
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@ -12,6 +12,14 @@
|
|||||||
"args": ["D2Delta_300.gcd", "fenix5Plus_510.gcd", "GUPDATE.GCD", "fenix5Plus_510.gcd"],
|
"args": ["D2Delta_300.gcd", "fenix5Plus_510.gcd", "GUPDATE.GCD", "fenix5Plus_510.gcd"],
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Python: gcdstruct.py",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/gcdstruct.py",
|
||||||
|
"args": ["D2Delta_300.gcd"],
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Python: Attach",
|
"name": "Python: Attach",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
|
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@ -4,9 +4,9 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "Run fenix5Plus_510.gcd",
|
"label": "Run gcdstruct.py",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "python3 gcd.py fenix5Plus_510.gcd",
|
"command": "python3 gcdstruct.py fenix5Plus_510.gcd",
|
||||||
"group": {
|
"group": {
|
||||||
"kind": "build",
|
"kind": "build",
|
||||||
"isDefault": true
|
"isDefault": true
|
||||||
|
12
binsum.py
12
binsum.py
@ -52,5 +52,13 @@ with open(FILE, "rb") as f:
|
|||||||
if len(block) < BLOCKSIZE:
|
if len(block) < BLOCKSIZE:
|
||||||
break
|
break
|
||||||
f.close()
|
f.close()
|
||||||
print("Calculated SHA1: {}".format(csum.hexdigest()))
|
|
||||||
print("SHA1 in file : {} (offset 0x{:x})".format(trailer[:20].hex(), trailer_pos))
|
expected_sha1 = csum.hexdigest()
|
||||||
|
found_sha1 = trailer[:20].hex()
|
||||||
|
print("Calculated SHA1: {}".format(expected_sha1))
|
||||||
|
print("SHA1 in file : {} (offset 0x{:x})".format(found_sha1, trailer_pos))
|
||||||
|
|
||||||
|
if expected_sha1 == found_sha1:
|
||||||
|
print("☑ CHECKSUM VALID.")
|
||||||
|
else:
|
||||||
|
print("☒ CHECKSUM INVALID!!! (Or GCD or other type.)")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user