fluencelabs / fluencelabs/dev-rewards

HASH=$(...) fails silently if the wrong sha3sum is installed

Open
#144 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
569
Forks
359
PR merge metrics
No merged PRs in 30d

Description

Suppose you're on a Mac and you've run `brew install sha3sum`, giving you a `sha3sum` command that's incompatible with the expected one.

Then this line:

```shell
HASH=$(echo -n "$DATA_HEX" | xxd -r -p | (sha3sum -a Keccak256 -t || true) | sed 's/[^[:xdigit:]].*//')
```

writes

`/opt/homebrew/bin/sha3sum: valid arguments for -a are 224 (default), 256, 384, and 512`

to stderr and returns an empty value. Later on,

```shell
SIGNATURE_HEX=$(echo "$HASH" | xxd -r -p | openssl pkeyutl -sign -inkey "$ETH_KEY" | xxd -p -c 72)
```

will successfully sign an empty string.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.