hashes.chaos_machine

Example of a simple chaos machine (chaos-based PRNG).

A chaos machine uses chaotic dynamical systems to generate pseudo-random numbers. This implementation combines a logistic map with a Xorshift PRNG.

References:

Attributes

K

buffer_space

m

machine_time

message

params_space

t

Functions

pull(→ int)

Pull a pseudo-random number from the chaos machine.

push(→ None)

Push a seed value into the chaos machine.

reset(→ None)

Reset the chaos machine to its initial state.

Module Contents

hashes.chaos_machine.pull() → int

Pull a pseudo-random number from the chaos machine.

Uses a Xorshift PRNG seeded by the current chaotic state.

Returns:

A 32-bit unsigned integer.

>>> reset()
>>> isinstance(pull(), int)
True
>>> 0 <= pull() <= 0xFFFFFFFF
True
hashes.chaos_machine.push(seed: float) → None

Push a seed value into the chaos machine.

Updates the internal buffer and parameter spaces using a logistic-map transition function.

Args:

seed: A numeric seed to push into the machine.

hashes.chaos_machine.reset() → None

Reset the chaos machine to its initial state.

hashes.chaos_machine.K = [0.33, 0.44, 0.55, 0.44, 0.33]
hashes.chaos_machine.buffer_space: list[float] = []
hashes.chaos_machine.m = 5
hashes.chaos_machine.machine_time = 0
hashes.chaos_machine.message
hashes.chaos_machine.params_space: list[float] = []
hashes.chaos_machine.t = 3