Skip to content

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

@kstrauser

Description

@kstrauser

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:

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,

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

will successfully sign an empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions