mirror of
https://github.com/status-im/nim-eth.git
synced 2025-01-12 15:24:21 +00:00
56f72c7a66
* Revert "hash compatibility fix (#717)" This reverts commit 047de2b788b485cca83c6d77f9a2e5f1e56ab656. * Revert "port eth2_digest speedups to eth_hash (#716)" This reverts commit 864d54467e09c08d62b508149e9184001a813363.
18 lines
433 B
Nim
18 lines
433 B
Nim
import
|
|
stew/byteutils,
|
|
./trie_defs
|
|
|
|
export trie_defs
|
|
|
|
template checkValidHashZ*(x: untyped) =
|
|
when x.type isnot KeccakHash:
|
|
doAssert(x.len == 32 or x.len == 0)
|
|
|
|
template isZeroHash*(x: openArray[byte]): bool =
|
|
x.len == 0
|
|
|
|
proc hashFromHex*(bits: static[int], input: string): MDigest[bits] =
|
|
MDigest(data: hexToByteArray[bits div 8](input))
|
|
|
|
template hashFromHex*(s: static[string]): untyped = hashFromHex(s.len * 4, s)
|