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.
This commit is contained in:
Christopher Haster
2025-04-14 02:44:20 -05:00
parent a5747bb2b2
commit 9085f1fdd9
2 changed files with 2 additions and 2 deletions

View File

@@ -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: