nim-eth/eth/trie/trie_utils.nim
Jacek Sieka 56f72c7a66
Revert speedups (#718)
* Revert "hash compatibility fix (#717)"

This reverts commit 047de2b788b485cca83c6d77f9a2e5f1e56ab656.

* Revert "port eth2_digest speedups to eth_hash (#716)"

This reverts commit 864d54467e09c08d62b508149e9184001a813363.
2024-08-09 07:20:35 +02:00

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)