Fix decode debug logging to use stderr for systemd journal

Debug prints need file=sys.stderr to appear in journalctl output.
Encode route was fixed but decode was still using plain print().

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-04 20:42:24 -05:00
parent 8622f1a850
commit 038fd6ceac

View File

@@ -888,11 +888,12 @@ def encode_page():
# DEBUG: Log file hashes to verify bytes match between encode/decode # DEBUG: Log file hashes to verify bytes match between encode/decode
import hashlib import hashlib
import sys
ref_hash = hashlib.md5(ref_data).hexdigest()[:8] ref_hash = hashlib.md5(ref_data).hexdigest()[:8]
carrier_hash = hashlib.md5(carrier_data).hexdigest()[:8] carrier_hash = hashlib.md5(carrier_data).hexdigest()[:8]
print(f"[ENCODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}") print(f"[ENCODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}", file=sys.stderr)
print(f"[ENCODE DEBUG] carrier: {len(carrier_data)} bytes, md5: {carrier_hash}") print(f"[ENCODE DEBUG] carrier: {len(carrier_data)} bytes, md5: {carrier_hash}", file=sys.stderr)
print(f"[ENCODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'") print(f"[ENCODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'", file=sys.stderr)
# Handle RSA key - can come from .pem file or QR code image # Handle RSA key - can come from .pem file or QR code image
rsa_key_data = None rsa_key_data = None
@@ -1189,9 +1190,9 @@ def decode_page():
import hashlib import hashlib
ref_hash = hashlib.md5(ref_data).hexdigest()[:8] ref_hash = hashlib.md5(ref_data).hexdigest()[:8]
stego_hash = hashlib.md5(stego_data).hexdigest()[:8] stego_hash = hashlib.md5(stego_data).hexdigest()[:8]
print(f"[DECODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}") print(f"[DECODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}", file=sys.stderr)
print(f"[DECODE DEBUG] stego: {len(stego_data)} bytes, md5: {stego_hash}") print(f"[DECODE DEBUG] stego: {len(stego_data)} bytes, md5: {stego_hash}", file=sys.stderr)
print(f"[DECODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'") print(f"[DECODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'", file=sys.stderr)
# Handle RSA key - can come from .pem file or QR code image # Handle RSA key - can come from .pem file or QR code image
rsa_key_data = None rsa_key_data = None