Skip to content

Commit

Permalink
Update hash function from blake2b to keccak
Browse files Browse the repository at this point in the history
  • Loading branch information
mratsim committed Dec 11, 2018
1 parent 10ed2bd commit 2dcbdc2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test_vectors_generator/tgen_shuffling.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@
import random

Hash32 = NewType('Hash32', bytes)
from hashlib import blake2b

## See https://github.com/ethereum/eth2.0-specs/pull/227
## and https://github.com/ethereum/eth2.0-specs/issues/151
## Hashing as been changed from Blake2b-512[:32] to Keccak256

# from hashlib import blake2b
# def hash(x):
# return blake2b(x).digest()[:32]

from eth_utils import keccak
def hash(x):
return blake2b(x).digest()[:32]
return keccak(x)

class ValidatorStatus(IntEnum):
PENDING_ACTIVATION = 0
Expand Down Expand Up @@ -278,7 +286,7 @@ def strSlot(slot_id: int, sacs: List[ShardAndCommittee]) -> str:

# Config
random.seed(int("0xEF00BEAC", 16))
num_val = 15 # Number of validators
num_val = 256 # Number of validators


seedhash = bytes(random.randint(0, 255) for byte in range(32))
Expand Down

0 comments on commit 2dcbdc2

Please sign in to comment.