Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions hashes/chaos_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def push(seed):
global buffer_space, params_space, machine_time, K, m, t
global buffer_space, params_space, machine_time

# Choosing Dynamical Systems (All)
for key, value in enumerate(buffer_space):
Expand All @@ -40,14 +40,7 @@ def push(seed):


def pull():
global buffer_space, params_space, machine_time, K, m, t

# PRNG (Xorshift by George Marsaglia)
def xorshift(x, y):
x ^= y >> 13
y ^= x << 17
x ^= y >> 5
return x
global buffer_space, params_space, machine_time

# Choosing Dynamical Systems (Increment)
key = machine_time % m
Expand All @@ -69,11 +62,15 @@ def xorshift(x, y):
# Machine Time
machine_time += 1

return xorshift(x, y) % 0xFFFFFFFF
# PRNG (Xorshift by George Marsaglia)
x ^= y >> 13
y ^= x << 17
x ^= y >> 5
return x & 0xFFFFFFFF


def reset():
global buffer_space, params_space, machine_time, K, m, t
global buffer_space, params_space, machine_time

buffer_space = K
params_space = [0] * m
Expand All @@ -95,7 +92,7 @@ def reset():
inp = ""

# Pulling Data (Output)
while inp in ("e", "E"):
while inp not in ("e", "E"):
print(f"{format(pull(), '#04x')}")
print(buffer_space)
print(params_space)
Expand Down