Skip to content

Verify that passing random.Random.seed a str is okay #7

@lvh

Description

@lvh

Right now, when you ask exercises.Secret to give you a non-secure PRNG, it derives a key (str) and passes it to random.Random.seed. It has the wonderful API that lets you pass in anything hashable; but it's not clear just how much entropy survives. Since this is explicitly NOT for cryptographically secure PRNG purposes, we probably don't really care, but this might be interesting information for other people.

Right now, the str hashing algorithm in CPython is FNV-1; see detailed description in PEP 456.

So then I guess we have to care what Py_uhash_t is, and how big the seed is for the MT variant Python uses on 64 bit machines, and, perhaps most importantly, how much bias FNV-1 introduces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions