Skip to content

Conversation

kdudka
Copy link
Member

@kdudka kdudka commented Aug 27, 2024

... where TEng::digest_type expands to an array of chars rather than an array of ints. This caused each byte in the resulting hash string to be prepended by 3 zero bytes, which was detected by the CI on macOS:

--- /Users/runner/work/csdiff/csdiff/tests/csgrep/0036-csgrep-json-stdout.txt	2024-08-26 16:59:02
+++ -	2024-08-26 17:00:30
@@ -4,7 +4,7 @@
             "checker": "SHELLCHECK_WARNING",
             "language": "shell",
             "tool": "shellcheck",
-            "hash_v1": "b6311c1fdc52c47d4279cd6650af36e6f8299960",
+            "hash_v1": "000000b6000000310000001c0000001f000000dc00000052000000c40000007d0000004200000079000000cd0000006600000050000000af00000036000000e6000000f8000000290000009900000060",
             "key_event_idx": 0,
             "events": [
                 {

Also use the hex_lower algorithm to optimize out the extra traversal step to lower the output string.

@kdudka kdudka self-assigned this Aug 27, 2024
kdudka added a commit to kdudka/csdiff that referenced this pull request Aug 27, 2024
... to optimize out the extra traversal step to lower the output string.

Closes: csutils#200
lzaoral and others added 2 commits August 27, 2024 10:26
... where `TEng::digest_type` expands to an array of chars rather than
an array of ints.  This caused each byte in the resulting hash string
to be prepended by 3 zero bytes, which was detected by the CI on macOS:
```
--- /Users/runner/work/csdiff/csdiff/tests/csgrep/0036-csgrep-json-stdout.txt	2024-08-26 16:59:02
+++ -	2024-08-26 17:00:30
@@ -4,7 +4,7 @@
             "checker": "SHELLCHECK_WARNING",
             "language": "shell",
             "tool": "shellcheck",
-            "hash_v1": "b6311c1fdc52c47d4279cd6650af36e6f8299960",
+            "hash_v1": "000000b6000000310000001c0000001f000000dc00000052000000c40000007d0000004200000079000000cd0000006600000050000000af00000036000000e6000000f8000000290000009900000060",
             "key_event_idx": 0,
             "events": [
                 {
```
... to optimize out the extra traversal step to lower the output string.

Closes: csutils#200
@kdudka kdudka requested a review from jamacku August 27, 2024 08:40
@kdudka kdudka marked this pull request as ready for review August 27, 2024 08:40
Copy link
Member

@jamacku jamacku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kdudka
Copy link
Member Author

kdudka commented Aug 27, 2024

Merging, thank you both!

@kdudka kdudka closed this in a6c08ed Aug 27, 2024
@kdudka kdudka merged commit a6c08ed into csutils:main Aug 27, 2024
@kdudka kdudka deleted the hash-util branch August 27, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants