From dd7330f58a44c9484e44c591c333fe0ff1a2eb98 Mon Sep 17 00:00:00 2001 From: Orien Vandenbergh Date: Fri, 2 Sep 2016 19:37:12 -0600 Subject: [PATCH] Add support for stupid --- python/foobar/three/hash_it_in.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/python/foobar/three/hash_it_in.py b/python/foobar/three/hash_it_in.py index 690a06c..19233a2 100644 --- a/python/foobar/three/hash_it_in.py +++ b/python/foobar/three/hash_it_in.py @@ -21,27 +21,6 @@ def mod(a): def xor(a,b): return a ^ b -def first_round(c,i0,i1,o): - for name,opers in operations.iteritems(): - calculate(name,opers,c,i0,i1,o) - -#def calculate(name,opers,c,i0,i1,o): -# trials = itertools.permutations([c,i0,i1]) -# -# t = 0 -# for trial in trials: -# trial = list(trial) -# for i in range(0,len(opers)): -# if opers[i] == "mult": -# trial.insert(0,mult(trial.pop(0),trial.pop(0))) -# elif opers[i] == "xor": -# trial.insert(0,xor(trial.pop(0),trial.pop(0))) -# elif opers[i] == "mod": -# trial.insert(0,mod(trial.pop(0))) -# if trial[0] == o: -# print "Success using [%s] variant [%d] %d == %d" %(name,t,trial[0],o) -# t += 1 - def dereference(operand,c,i0,i1): if operand == "c": return c @@ -70,7 +49,10 @@ def first_tier(i0,i1,o): operations = { "*^%": ["mult","xor","mod"], "*%^": ["mult","mod","xor"], - "^*%": ["xor","mult","mod"] + "^*%": ["xor","mult","mod"], + "^%*": ["xor","mod","mult"], + "*%^": ["mod","mult","xor"], + "*^%": ["mod","xor","mult"] } for oidx,operand in enumerate(operands):