Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Keccak256 #89

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion protobuf/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (msg *Substate_TxMessage) getContractAddress() types.Address {
// mimics crypto.CreateAddress, to avoid cyclical dependency.
func createAddress(addr types.Address, nonce uint64) types.Address {
data, _ := trlp.EncodeToBytes([]interface{}{addr, nonce})
return types.BytesToAddress(hash.Keccak256(data)[12:])
return types.BytesToAddress(hash.Keccak256Hash(data).Bytes()[12:])
}

// decode converts protobuf-encoded Substate_Result into aida-comprehensible Result
Expand Down
11 changes: 0 additions & 11 deletions types/hash/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ func NewKeccakState() KeccakState {
return sha3.NewLegacyKeccak256().(KeccakState)
}

// Keccak256 calculates and returns the Keccak256 hash of the input data.
func Keccak256(data ...[]byte) []byte {
b := make([]byte, 32)
d := NewKeccakState()
for _, b := range data {
d.Write(b)
}
d.Read(b)
return b
}

// Keccak256Hash calculates and returns the Keccak256 hash of the input data,
// converting it to an internal Hash data structure.
func Keccak256Hash(data ...[]byte) (h types.Hash) {
Expand Down
Loading