From 7520f65a2afeac251a48c4546db1b92b8d8ca206 Mon Sep 17 00:00:00 2001 From: Saba633 Date: Thu, 13 Mar 2025 22:06:37 +0500 Subject: [PATCH 1/2] Updated chaos machine algorithm --- hashes/chaos_machine.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/hashes/chaos_machine.py b/hashes/chaos_machine.py index d2fde2f5e371..24cd9626a4de 100644 --- a/hashes/chaos_machine.py +++ b/hashes/chaos_machine.py @@ -1,18 +1,29 @@ -"""example of simple chaos machine""" +"""example of simple chaos machine + Simple Chaos Machine refers to computational model that demonstrates chaotic behavior. + It takes input values, applies a chaotic transformation using control theory principles, and generates + unpredictable output ( meaning small changes in input lead to drastically different outputs over time),""" + +""" Chaos Machine (K, t, m) + K --> Initial values for the buffer space. + t --> Time length for evolution (how long transformations happen). + m --> Number of elements in the chaotic system.""" -# Chaos Machine (K, t, m) K = [0.33, 0.44, 0.55, 0.44, 0.33] t = 3 m = 5 -# Buffer Space (with Parameters Space) +# Buffer Space (with Parameters Space) --> Stores values undergoing chaotic transformation. buffer_space: list[float] = [] + +# Stores parameters controlling the transformation. params_space: list[float] = [] -# Machine Time +# Machine Time --> Keeps track of execution time. machine_time = 0 - +"""The push() function updates the buffer_space and params_space by applying chaotic transformations +based on control theory. It modifies all values in the buffer_space using an orbit change and trajectory change formula, +which ensure values to stay within controlled chaotic limits. Finally, it increments machine_time.""" def push(seed): global buffer_space, params_space, machine_time, K, m, t @@ -39,6 +50,9 @@ def push(seed): machine_time += 1 +"""The pull() function generates a chaotic pseudo-random number using a logistic map transformation +and the Xorshift algorithm. It updates buffer_space and params_space over multiple iterations, ensuring chaotic evolution. +Finally, it selects two chaotic values, applies Xorshift, and returns a 32-bit random number.""" def pull(): global buffer_space, params_space, machine_time, K, m, t @@ -99,4 +113,4 @@ def reset(): print(f"{format(pull(), '#04x')}") print(buffer_space) print(params_space) - inp = input("(e)exit? ").strip() + inp = input("(e)exit? ").strip() \ No newline at end of file From 04665915fadd2c27843b44ddd75488c85adcbc17 Mon Sep 17 00:00:00 2001 From: Saba633 Date: Fri, 14 Mar 2025 16:18:39 +0500 Subject: [PATCH 2/2] Updated chaos machine algorithm --- hashes/chaos_machine.py | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/hashes/chaos_machine.py b/hashes/chaos_machine.py index 24cd9626a4de..450a507bf861 100644 --- a/hashes/chaos_machine.py +++ b/hashes/chaos_machine.py @@ -1,7 +1,10 @@ -"""example of simple chaos machine - Simple Chaos Machine refers to computational model that demonstrates chaotic behavior. - It takes input values, applies a chaotic transformation using control theory principles, and generates - unpredictable output ( meaning small changes in input lead to drastically different outputs over time),""" +""" example of simple chaos machine + Simple Chaos Machine refers to computational model + that demonstrates chaotic behavior. It takes input values, + applies a chaotic transformation using control theory + principles, and generates unpredictable output ( meaning + small changes in input lead to drastically different outputs + over time),""" """ Chaos Machine (K, t, m) K --> Initial values for the buffer space. @@ -12,18 +15,24 @@ t = 3 m = 5 -# Buffer Space (with Parameters Space) --> Stores values undergoing chaotic transformation. +# Buffer Space (with Parameters Space) +# --> Stores values undergoing chaotic transformation. buffer_space: list[float] = [] # Stores parameters controlling the transformation. params_space: list[float] = [] -# Machine Time --> Keeps track of execution time. +# Machine Time +# --> Keeps track of execution time. machine_time = 0 -"""The push() function updates the buffer_space and params_space by applying chaotic transformations -based on control theory. It modifies all values in the buffer_space using an orbit change and trajectory change formula, -which ensure values to stay within controlled chaotic limits. Finally, it increments machine_time.""" +"""The push() function updates the buffer_space and +params_space by applying chaotic transformations +based on control theory. It modifies all values in the +buffer_space using an orbit change and trajectory +change formula, which ensure values to stay within +controlled chaotic limits. Finally, it increments +machine_time.""" def push(seed): global buffer_space, params_space, machine_time, K, m, t @@ -50,9 +59,13 @@ def push(seed): machine_time += 1 -"""The pull() function generates a chaotic pseudo-random number using a logistic map transformation -and the Xorshift algorithm. It updates buffer_space and params_space over multiple iterations, ensuring chaotic evolution. -Finally, it selects two chaotic values, applies Xorshift, and returns a 32-bit random number.""" +"""The pull() function generates a chaotic pseudo-random +number using a logistic map transformation and the +Xorshift algorithm. It updates buffer_space and params_space +over multiple iterations, ensuring chaotic evolution. Finally, +it selects two chaotic values, applies Xorshift, and returns a +32-bit random number.""" + def pull(): global buffer_space, params_space, machine_time, K, m, t