Skip to content

Apparent issues with cipher quality #10

@FrozenBob

Description

@FrozenBob

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions