Skip to content

Commit

Permalink
Cache pederson hash function, to speed up Merkle root computation
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Dec 29, 2022
1 parent 2708017 commit 690bf9a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/provers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import shutil
from abc import ABC, abstractmethod
from functools import cache
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import List, Tuple
Expand All @@ -18,6 +19,7 @@
def hash_bytes_sha256(bytes_to_hash: bytes):
return hashlib.sha256(bytes_to_hash).digest()

@cache
def hash_bytes_pedersen(bytes_to_hash: bytes):
return pedersen_hasher.hash_bytes(bytes_to_hash).compress()

Expand Down

0 comments on commit 690bf9a

Please sign in to comment.