Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Puzzle - 0CTF 2021 lalamblambdadambda #15

Open
ThinerDAS opened this issue Jul 15, 2021 · 0 comments
Open

New Puzzle - 0CTF 2021 lalamblambdadambda #15

ThinerDAS opened this issue Jul 15, 2021 · 0 comments

Comments

@ThinerDAS
Copy link

ThinerDAS commented Jul 15, 2021

Original author of the CTF challenge is believed to be @hzqmwne

def sat(x: str): 
    """0CTF 2021 lalamblambdadambda pseudo code, all rights belong to original author of challenge"""
    buf = bytes.fromhex(s[:16])
    S0 = []
    for i in range(8):
        for j in range(8):
            S0.append(((lambda b:lambda a:a),(lambda b:lambda a:b))[1&(buf[i]>>j)])
    S1 = [True,False]
    
    f1 = (lambda c:lambda b:lambda a:c(b)(a))
    f5 = (lambda c:lambda b:lambda a:f1(a)(c)(b))
    f6 = (lambda b:lambda a:f5(b)(a))
    f7 = (lambda d:lambda c:lambda b:lambda a:f5(f5(d)(c))(f5(b)(a)))
    f8 = (lambda d:lambda c:lambda b:lambda a:f5(f6(d)(c))(f6(b)(a)))
    f9 = (lambda h:lambda g:lambda f:lambda e:lambda d:lambda c:lambda b:lambda a:f5(f8(h)(g)(f)(e))(f8(d)(c)(b)(a)))
    f12 = (lambda b:lambda a:a)
    f13 = (lambda a:f12)
    f15 = f5(f5(f5(f5(f5(f12)(f12))(f5(f12)(f12)))(f5(f5(f12)(f12))(f5(f12)(f12))))(f5(f5(f5(f12)(f12))(f5(f12)(f12)))(f5(f5(f12)(f12))(f5(f12)(f12)))))(f5(f5(f5(f5(f12)(f12))(f5(f12)(f12)))(f5(f5(f12)(f12))(f5(f12)(f12))))(f5(f5(f5(f12)(f12))(f5(f12)(f12)))(f5(f5(f12)(f12))(f5(f12)(f12)))))
    f16 = f5(f15)
    f28 = (
        (lambda b:lambda a:
      b
      (
        b
        (
          b
          (
            b
            (
              b
              (
                b
                (
                  b
                  (
                    b
                    (
                      b
                      (
                        b
                        (
                          b
                          (
                            b
                            (
                              b
                              (
                                b
                                (
                                  b
                                  (
                                    b
                                    (
                                      b
                                      (
                                        b
                                        (
                                          b
                                          (
                                            b
                                            (
                                              b
                                              (
                                                b
                                                (
                                                  b
                                                  (
                                                    b
                                                    (
                                                      b
                                                      (
                                                        b
                                                        (
                                                          b(b(b(b(b(b(a))))))
                                                        )
                                                      )
                                                    )
                                                  )
                                                )
                                              )
                                            )
                                          )
                                        )
                                      )
                                    )
                                  )
                                )
                              )
                            )
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        )
      )
    )
    )
    f30 = (lambda b:lambda a:b(a)(b))
    f33 = (lambda b:lambda a:b(b)(a))
    f41 = (lambda b:lambda a:b)
    f42 = (lambda a:a)
    f43 = (lambda c:(lambda a:c(a(a)))((lambda b:c((lambda a:b(b)(a))))))
    f2 = (lambda e:lambda d:lambda c:e((lambda b:lambda a:a(b(d))))((lambda a:c))(f42))
    f3 = (lambda a:a(f13)(f41))
    f10 = (lambda a:a(f12))
    f11 = (lambda a:a(f41))
    f17 = f7(f9(f12)(f12)(f41)(f41)(f12)(f12)(f12)(f12))(f9(f12)(f41)(f41)(f12)(f41)(f41)(f41)(f12))(f9(f12)(f12)(f41)(f41)(f12)(f41)(f12)(f41))(f9(f41)(f12)(f12)(f41)(f12)(f12)(f12)(f41))
    f18 = f7(f9(f12)(f41)(f41)(f12)(f12)(f12)(f12)(f41))(f9(f41)(f12)(f41)(f12)(f12)(f12)(f12)(f41))(f9(f12)(f12)(f41)(f12)(f12)(f41)(f41)(f12))(f9(f12)(f41)(f41)(f41)(f41)(f41)(f41)(f41))
    f19 = f7(f9(f41)(f12)(f12)(f12)(f12)(f41)(f41)(f12))(f9(f41)(f41)(f41)(f41)(f12)(f12)(f41)(f12))(f9(f41)(f41)(f12)(f12)(f41)(f41)(f12)(f41))(f9(f12)(f41)(f41)(f12)(f12)(f41)(f12)(f12))
    f20 = f7(f9(f41)(f12)(f12)(f12)(f41)(f41)(f41)(f12))(f9(f12)(f41)(f12)(f41)(f41)(f41)(f41)(f41))(f9(f12)(f41)(f41)(f12)(f12)(f12)(f12)(f12))(f9(f41)(f12)(f12)(f41)(f41)(f12)(f12)(f12))
    f21 = f7(f9(f41)(f12)(f12)(f41)(f41)(f41)(f41)(f12))(f9(f12)(f12)(f41)(f41)(f12)(f41)(f41)(f41))(f9(f12)(f41)(f41)(f41)(f41)(f12)(f12)(f41))(f9(f41)(f12)(f41)(f41)(f41)(f12)(f12)(f41))
    f22 = f7(f9(f41)(f41)(f12)(f41)(f41)(f41)(f41)(f41))(f9(f41)(f12)(f12)(f41)(f41)(f12)(f41)(f41))(f9(f12)(f12)(f12)(f12)(f41)(f41)(f41)(f41))(f9(f41)(f41)(f12)(f41)(f12)(f12)(f12)(f12))
    f23 = f7(f9(f41)(f41)(f41)(f41)(f12)(f12)(f12)(f12))(f9(f41)(f41)(f12)(f12)(f41)(f41)(f12)(f12))(f9(f12)(f12)(f12)(f12)(f12)(f41)(f12)(f12))(f9(f41)(f41)(f12)(f41)(f12)(f41)(f12)(f12))
    f29 = (lambda a:f41)
    f32 = (lambda a:a(f12)(f41))
    f34 = (lambda b:lambda a:f33(f30(f32(b))(a))(f30(b)(f32(a))))
    f35 = (lambda b:lambda a:f34(b)(a))
    f36 = (lambda f:lambda e:lambda d:lambda c:(lambda b:(lambda a:f5(f11(a))(f5(f10(a))(f10(b))))(f(e(f41))(d(f41))(f11(b))))(f(e(f12))(d(f12))(c)))
    f37 = (lambda e:lambda d:lambda c:(lambda b:(lambda a:f5(f11(a))(f5(f10(a))(f10(b))))(e(d(f41))(f11(b))))(e(d(f12))(c)))
    f38 = (lambda e:lambda d:lambda c:(lambda b:(lambda a:f5(f11(a))(f5(f10(b))(f10(a))))(e(d(f12))(f11(b))))(e(d(f41))(c)))
    f39 = (lambda c:lambda b:lambda a:f30(c(b(f41))(a(f41)))(c(b(f12))(a(f12))))
    f40 = (lambda c:lambda b:lambda a:f5(c(b(f41))(a(f41)))(c(b(f12))(a(f12))))
    f0 = (lambda c:lambda b:lambda a:f5(f33(f30(c)(b))(f30(f34(c)(b))(a)))(f34(f34(c)(b))(a)))
    f14 = (
        (lambda b:lambda a:
      f10(f36(f36(f36(f36(f36(f0)))))(b)(a)(f12))
    )
    )
    f25 = (
        (lambda a:
      f10(f37(f37(f37(f37(f37(f6)))))(a)(f12))
    )
    )
    f26 = (
        (lambda a:
      f10(f38(f38(f38(f38(f38(f6)))))(a)(f12))
    )
    )
    f27 = f40(f40(f40(f40(f40(f35)))))
    f31 = (lambda b:lambda a:f33(f30(b)(a))(f30(f32(b))(f32(a))))
    f24 = f39(f39(f39(f39(f39(f31)))))
    f4 = (lambda a:f30(f24(f11(a))(f22))(f24(f10(a))(f17)))
    answer = (
        (lambda v50:lambda v49:lambda v48:lambda v47:lambda v46:lambda v45:lambda v44:lambda v43:lambda v42:lambda v41:lambda v40:lambda v39:lambda v38:lambda v37:lambda v36:lambda v35:lambda v34:lambda v33:lambda v32:lambda v31:lambda v30:lambda v29:lambda v28:lambda v27:lambda v26:lambda v25:lambda v24:lambda v23:lambda v22:lambda v21:lambda v20:lambda v19:lambda v18:lambda v17:lambda v16:lambda v15:lambda v14:lambda v13:lambda v12:lambda v11:lambda v10:lambda v9:lambda v8:lambda v7:lambda v6:lambda v5:lambda v4:lambda v3:lambda v2:lambda v1:lambda v0:lambda z:lambda y:lambda x:lambda w:lambda v:lambda u:lambda t:lambda s:lambda r:lambda q:lambda p:lambda o:lambda n:
      f4
      (
        (lambda m:lambda l:
          f10
          (
            f43
            (
              (lambda k:lambda j:lambda i:
                f3(j)(i)
                (
                  (lambda h:
                    k(f2(j))
                    (
                      (lambda g:
                        (lambda f:
                          (lambda e:
                            (lambda d:
                              (lambda c:
                                (lambda b:
                                  (lambda a:f5(c)(f5(b)(a)))
                                  (
                                    f14(d)
                                    (
                                      f27
                                      (
                                        f27(f14(f25(f25(f25(f25(b)))))(f23))(f14(b)(c))
                                      )
                                      (
                                        f14(f26(f26(f26(f26(f26(b))))))(f18)
                                      )
                                    )
                                  )
                                )
                                (
                                  f14(e)
                                  (
                                    f27
                                    (
                                      f27(f14(f25(f25(f25(f25(d)))))(f19))(f14(d)(c))
                                    )
                                    (
                                      f14(f26(f26(f26(f26(f26(d))))))(f20)
                                    )
                                  )
                                )
                              )
                              (f14(f)(f21))
                            )
                            (f10(f10(g)))
                          )
                          (f11(f10(g)))
                        )
                        (f11(g))
                      )
                      (i)
                    )
                    (h)
                  )
                )
              )
            )
            (f28)(f16(f5(m)(l)))
          )
        )
        (f7(f9(v19)(v20)(v21)(v22)(v23)(v24)(v25)(v26))(f9(v27)(v28)(v29)(v30)(v31)(v32)(v33)(v34))(f9(v35)(v36)(v37)(v38)(v39)(v40)(v41)(v42))(f9(v43)(v44)(v45)(v46)(v47)(v48)(v49)(v50)))(f7(f9(n)(o)(p)(q)(r)(s)(t)(u))(f9(v)(w)(x)(y)(z)(v0)(v1)(v2))(f9(v3)(v4)(v5)(v6)(v7)(v8)(v9)(v10))(f9(v11)(v12)(v13)(v14)(v15)(v16)(v17)(v18)))
      )
    )
    (S0[0])(S0[1])(S0[2])(S0[3])(S0[4])(S0[5])(S0[6])(S0[7])(S0[8])(S0[9])(S0[10])(S0[11])(S0[12])(S0[13])(S0[14])(S0[15])(S0[16])(S0[17])(S0[18])(S0[19])(S0[20])(S0[21])(S0[22])(S0[23])(S0[24])(S0[25])(S0[26])(S0[27])(S0[28])(S0[29])(S0[30])(S0[31])(S0[32])(S0[33])(S0[34])(S0[35])(S0[36])(S0[37])(S0[38])(S0[39])(S0[40])(S0[41])(S0[42])(S0[43])(S0[44])(S0[45])(S0[46])(S0[47])(S0[48])(S0[49])(S0[50])(S0[51])(S0[52])(S0[53])(S0[54])(S0[55])(S0[56])(S0[57])(S0[58])(S0[59])(S0[60])(S0[61])(S0[62])(S0[63])(S1[0])(S1[1])
    )

    return answer

Solvers, post your solutions in the comments using the following formatting:

Reveal solution
def sol():
    return 'fe54620f00feb0ad'
@ThinerDAS ThinerDAS changed the title 0CTF 2021 lalamblambdadambda New Puzzle - 0CTF 2021 lalamblambdadambda Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant