zoukankan      html  css  js  c++  java
  • ISCC2019-digdigdig

    终于做出来这道题了,一共三段加密,不了解各加密方式的算法吃了大亏。。。

    第一层:

    base64需要用到的字符,再看后面的取余3,替换为=,更加确定了,经过动态调试,验证了确实是。

    第二层:

    一味的逆算法,却没动脑子,直到拿到flag看到提示才知道这是rot13,我是真的菜。也很好辨认,取余26很明显的特征,当时不知道想啥呢。

    第三层:

    现在还不知道什么加密,希望有大佬指点。

    i是长度,v12就是解密的第一个字符,可以很容易知道我们最终是与‘@1DE!440S9W9,2T%Y07=%<W!Z.3!:1T%S2S-),7-$/3T ’这段字符串比较,第一个是@,剩余44个字符进行解密。因为长度是32,我们先解密前40个字符,最后4个特殊,另解。

    下面给出代码:

    第一步:

    stri = '1DE!440S9W9,2T%Y07=%<W!Z.3!:1T%S2S-),7-$/3T '
    s = string.ascii_letters + string.digits
    i3 = ''
    o = [0, 0, 0, 0]
    i = 0
    while i < 40:
        break_flag = 0
        print(i)
        for x in s:
            for y in s:
                for z in s:
                    o[0] = (ord(x) >> 2) + 32
                    o[1] = ((16 * ord(x) & 0x30) + 32) | (ord(y) >> 4)
                    if i == 40:
                        o[2] = ((4 * ord(y) & 0x3c) + 32) | (0 >> 6)
                        o[3] = 32
                    else:
                        o[2] = ((4 * ord(y) & 0x3c) + 32) | (ord(z) >> 6)
                        o[3] = (ord(z) & 0x3f) + 32
                    if o[0] == ord(stri[i]) and o[1] == ord(stri[i+1]) and o[2] == ord(stri[i+2]) and o[3] == ord(stri[i+3]):
                        i3 += x + y + z
                        print(i3)
                        i += 4
                        break_flag = 1
                        break
                if break_flag == 1:
                    break
            if break_flag == 1:
                break
    print(i3)
    最后4个解密:
    for i in s:
    for j in s:
    o[0] = (ord(i) >> 2) + 32
    o[1] = ((16 * ord(i) & 0x30) + 32) | (ord(j) >> 4)
    o[2] = ((4 * ord(j) & 0x3c) + 32) | (0 >> 6)
    if o[0] == ord('/') and o[1] == ord('3') and o[2] == ord('T'):
    i3 += i + j
    break

      第二步:

    tmp = ''
    for i in range(len(ou)):
        for j in range(255):
            if j <= 64 or j > 90:
                if j <= 96 or j > 122:
                    o1 = j
                else:
                    o1 = (j - 84) % 26 + 97
            else:
                o1 = (j - 52) % 26 + 65
            if chr(o1) == ou[i]:
                tmp += chr(j)
                break
    print(tmp)
    或者直接rot13
    

      第三步:

    base64解密吧,不写脚本了麻烦,哈哈哈。

  • 相关阅读:
    Codeforces Round 546 (Div. 2)
    Codeforces Round 545 (Div. 2)
    Codeforces Round 544(Div. 3)
    牛客小白月赛12
    Codeforces Round 261(Div. 2)
    Codeforces Round 260(Div. 2)
    Codeforces Round 259(Div. 2)
    Codeforces Round 258(Div. 2)
    Codeforces Round 257 (Div. 2)
    《A First Course in Probability》-chaper5-连续型随机变量-随机变量函数的分布
  • 原文地址:https://www.cnblogs.com/whitehawk/p/10881970.html
Copyright © 2011-2022 走看看