fix(cast): read all lines for message to hash by grandizzy · Pull Request #10671 · foundry-rs/foundry (original) (raw)

Motivation

#!/usr/bin/env bash message_raw=$(<message.txt) hashed_message1=$(printf "%s" "$message_raw" | cast hash-message) hashed_message2=$(cast hash-message "$message_raw") echo $hashed_message1 echo $hashed_message2

where message.txt is something like

Welcome to OpenSea!

Click to sign in and accept the OpenSea Terms of Service (https://opensea.io/tos) and Privacy Policy (https://opensea.io/privacy).

This request will not trigger a blockchain transaction or cost any gas fees.

outputs different hashes

0xc36550d1b80343edd49ced11158a478faf57dbec05ade0b463149bc7b31d8df8
0x9ae3cff27abb1798440be7218c7c62070e7fca99d0a3b68b6ef451d64b15ba63

because in 1st case only first line is read

Solution

PR Checklist