mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-14 04:34:43 +00:00
big to little in shuffle
This commit is contained in:
parent
47b00f38dd
commit
b3db7b0394
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user