big to little in shuffle

This commit is contained in:
Danny Ryan 2019-02-06 20:32:05 -08:00 committed by GitHub
parent 47b00f38dd
commit b3db7b0394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)