Fix checksum following BIP-128 standard

Non-Ascii characters should not be converted for
checksum calculation.
This will give consistent hash to BIP-128 and its
Javascript code example.

Timelock-Recovery Plans that contained only ascii
characters are not affected.

Also, 8 hex-chars is enough for a checksum.
This commit is contained in:
Oren
2026-03-13 23:02:58 +02:00
parent 27a94ff5bd
commit 2f3f397a70
+2 -2
View File
@@ -687,10 +687,10 @@ class Plugin(TimelockRecoveryPlugin):
# object whose fields can be ordered in multiple ways).
return hashlib.sha256(json.dumps(
sorted(json_data.items()),
skipkeys=False, ensure_ascii=True, check_circular=True,
skipkeys=False, ensure_ascii=False, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=(',', ':'),
default=None, sort_keys=False,
).encode()).hexdigest()
).encode()).hexdigest()[:8]
def _save_recovery_plan_json(self, context: TimelockRecoveryContext, download_dialog: WindowModalDialog):
try: