Skip to content

Commit 1f41b40

Browse files
committed
Revert "fix: remove dead code - ethhash_keccak256_32 (ipsilon#1345)"
This reverts commit 40a3d29.
1 parent efa132d commit 1f41b40

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

lib/evmone_precompiles/keccak.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,3 +389,10 @@ union ethash_hash256 ethash_keccak256(const uint8_t* data, size_t size)
389389
keccak(hash.word64s, 256, data, size);
390390
return hash;
391391
}
392+
393+
union ethash_hash256 ethash_keccak256_32(const uint8_t data[32])
394+
{
395+
union ethash_hash256 hash;
396+
keccak(hash.word64s, 256, data, 32);
397+
return hash;
398+
}

lib/evmone_precompiles/keccak.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern "C" {
1717
#endif
1818

1919
union ethash_hash256 ethash_keccak256(const uint8_t* data, size_t size) noexcept;
20+
union ethash_hash256 ethash_keccak256_32(const uint8_t data[32]) noexcept;
2021

2122
#ifdef __cplusplus
2223
}

lib/evmone_precompiles/keccak.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@ inline hash256 keccak256(const uint8_t* data, size_t size) noexcept
1313
return ethash_keccak256(data, size);
1414
}
1515

16+
inline hash256 keccak256(const hash256& input) noexcept
17+
{
18+
return ethash_keccak256_32(input.bytes);
19+
}
20+
21+
static constexpr auto keccak256_32 = ethash_keccak256_32;
22+
1623
} // namespace ethash

0 commit comments

Comments
 (0)