From 3a7e75f329d14bad68043896b856fed36e7bc2ef Mon Sep 17 00:00:00 2001 From: Christian Bender Date: Mon, 16 Apr 2018 13:37:04 +0200 Subject: [PATCH] added a option for termination the program --- hashes/chaos_machine.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hashes/chaos_machine.py b/hashes/chaos_machine.py index 8b6c00438..59d0d7ffd 100644 --- a/hashes/chaos_machine.py +++ b/hashes/chaos_machine.py @@ -1,6 +1,12 @@ """example of simple chaos machine""" from __future__ import print_function +try: + raw_input + input = raw_input +except: + pass + # Chaos Machine (K, t, m) K = [0.33, 0.44, 0.55, 0.44, 0.33]; t = 3; m = 5 @@ -91,7 +97,11 @@ message = random.sample(range(0xFFFFFFFF), 100) for chunk in message: push(chunk) +# for controlling +inp = "" + # Pulling Data (Output) -while True: +while inp != "e" and inp != "E": print("%s" % format(pull(), '#04x')) print(buffer_space); print(params_space) + inp = input("(e)exit? ")