diff --git a/.vscode/launch.json b/.vscode/launch.json index e58fb03..e4549d9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,6 +12,14 @@ "args": ["D2Delta_300.gcd", "fenix5Plus_510.gcd", "GUPDATE.GCD", "fenix5Plus_510.gcd"], "console": "integratedTerminal" }, + { + "name": "Python: gcdstruct.py", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/gcdstruct.py", + "args": ["D2Delta_300.gcd"], + "console": "integratedTerminal" + }, { "name": "Python: Attach", "type": "python", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e95dbe7..762aae8 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,9 +4,9 @@ "version": "2.0.0", "tasks": [ { - "label": "Run fenix5Plus_510.gcd", + "label": "Run gcdstruct.py", "type": "shell", - "command": "python3 gcd.py fenix5Plus_510.gcd", + "command": "python3 gcdstruct.py fenix5Plus_510.gcd", "group": { "kind": "build", "isDefault": true diff --git a/binsum.py b/binsum.py index 83c81e3..7e874b3 100644 --- a/binsum.py +++ b/binsum.py @@ -52,5 +52,13 @@ with open(FILE, "rb") as f: if len(block) < BLOCKSIZE: break 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.)")