mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-03 03:24:59 -05:00
big to little in shuffle
This commit is contained in:
@@ -707,10 +707,10 @@ def shuffle(values: List[Any], seed: Bytes32) -> List[Any]:
|
||||
indices = list(range(len(values)))
|
||||
for round in range(90):
|
||||
hashvalues = b''.join([
|
||||
hash(seed + round.to_bytes(1, 'big') + i.to_bytes(4, 'big'))
|
||||
hash(seed + round.to_bytes(1, 'little') + i.to_bytes(4, 'little'))
|
||||
for i in range((len(values) + 255) // 256)
|
||||
])
|
||||
pivot = int.from_bytes(hash(seed + round.to_bytes(1, 'big')), 'big') % n
|
||||
pivot = int.from_bytes(hash(seed + round.to_bytes(1, 'little')), 'little') % n
|
||||
def permute(pos):
|
||||
flip = (pivot - pos) % n
|
||||
maxpos = max(pos, flip)
|
||||
|
||||
Reference in New Issue
Block a user