You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing an implementation of shuffling lists using pyffx, in an attempt to avoid holding the entire shuffled list in memory. One of my implementations is as follows:
def shuffle_generator(sequence):
key = secrets.token_bytes()
cipher = pyffx.Sequence(key, alphabet=sequence, length=1)
for i in sequence:
yield cipher.encrypt([i])[0]
In tests, this quickly proved to be a terrible shuffle. The result was always a rotation of the input - for example, list(shuffle_generator(range(5))) could produce [2, 3, 4, 0, 1] or [0, 1, 2, 3, 4], but never [0, 4, 2, 3, 1].
Am I using pyffx wrong in some way I'm not realizing?
I'm on pyffx 0.3.0 and Python 3.8.3.
The text was updated successfully, but these errors were encountered:
I was testing an implementation of shuffling lists using pyffx, in an attempt to avoid holding the entire shuffled list in memory. One of my implementations is as follows:
In tests, this quickly proved to be a terrible shuffle. The result was always a rotation of the input - for example,
list(shuffle_generator(range(5)))
could produce[2, 3, 4, 0, 1]
or[0, 1, 2, 3, 4]
, but never[0, 4, 2, 3, 1]
.Am I using pyffx wrong in some way I'm not realizing?
I'm on pyffx 0.3.0 and Python 3.8.3.
The text was updated successfully, but these errors were encountered: