From 9085f1fdd9927f1de11baab9ee20c180ceb31a15 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 14 Apr 2025 02:44:20 -0500 Subject: [PATCH] scripts: crc32c.py/parity.py: Show string with -s/--string This matches the behavior of paths and helps figure out which string is associated with which crc32c/parity when checksumming multiple strings: $ ./scripts/crc32c.py -s hi hello f59dd9c2 hi 9a71bb4c hello It also might help clear up confusion if someone forgets to quote a string with spaces inside it. --- scripts/crc32c.py | 2 +- scripts/parity.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/crc32c.py b/scripts/crc32c.py index 2dac14ab..1584e5e9 100755 --- a/scripts/crc32c.py +++ b/scripts/crc32c.py @@ -47,7 +47,7 @@ def main(paths, **args): # interpret as strings elif args.get('string'): for path in paths: - print('%08x' % crc32c(path.encode('utf8'))) + print('%08x %s' % (crc32c(path.encode('utf8')), path)) # default to interpreting as paths else: diff --git a/scripts/parity.py b/scripts/parity.py index c9b4fea2..09d89265 100755 --- a/scripts/parity.py +++ b/scripts/parity.py @@ -55,7 +55,7 @@ def main(paths, **args): # interpret as strings elif args.get('string'): for path in paths: - print('%01x' % parity(crc32c(path.encode('utf8')))) + print('%01x %s' % (parity(crc32c(path.encode('utf8'))), path)) # default to interpreting as paths else: