Skip to content

Instantly share code, notes, and snippets.

@glasnt
Last active February 7, 2016 10:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glasnt/8fa0d305f5af15d8a87f to your computer and use it in GitHub Desktop.
Save glasnt/8fa0d305f5af15d8a87f to your computer and use it in GitHub Desktop.
Lanyard.py Iterations
# from https://github.com/zookeepr/zookeepr/blob/3040eec8df44e6b4aba5d3312c8d1bcb6bb34fbb/zkpylons/lib/helpers.py#L293
def silly_description_checksum(desc):
import hashlib, math
haiku = "Come to Ballarat"\
"LCA Under the stars"\
"Comets is landing..."
#This is meant to be difficult to read, no telling me its indistinguishable from my normal code - Josh
def fun(cion):
e = 0.0
a = 4.1963944517268459E+00
b = -5.5753297516829114E+00
c = 2.7916995626938470E+00
d = -6.5696680861318413E-01
f = 7.2840990594877031E-02
g = -3.0390408978587477E-03
e = g
e = e * cion + f
e = e * cion + d
e = e * cion + c
e = e * cion + b
e = e * cion + a
e = 1.0 / e
return e
false = ""
true = False
for ny in range(1,9):
if (ny == 5) or (ny == 8):
false=false+(haiku[int(math.floor(fun(ny)+1))],haiku[int(math.ceil(fun(ny)+1))])[true]
else:
false=false+(haiku[int(math.floor(fun(ny)))],haiku[int(math.ceil(fun(ny)))])[true]
true = not true
false=false.lower()+"("+")"
# Some assistance provided here. All we're doing is taking the silly input string and hashing it with some mysterious salt. Mmmmmm salt
salted = desc + haiku+eval(false+chr(0x5B)+chr(0x31)+chr(0x5D)).encode(rot_26)
return hashlib.sha1(salted.encode('latin1')).hexdigest()
# Testing Wrapper
silly_desc = "a disturbingly alternate quinoa"
silly_desc_hash = "4c707619c4fc836a558eb661e43cf662a7e88600"
silly_desc_parse = silly_description_checksum(silly_desc)
if silly_desc_parse == silly_desc_hash:
print("Solved!")
else:
print("Unsolved.\n%s doesn't match %s" % (silly_desc_hash, silly_desc_parse))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment