p = 170141183460469231731687303715884106303 q = 170141183460469231731687303715884106207 n = p*q a = 0x2a40d7c86b81a63c850a531695b78ca4efc6e3e9d1ad0e83c6e88bfa16694dcb a1 = pow(a,(p+1)/4,p) a2 = pow(a,(q+1)/4,q) x = gmpy2.invert(p,q) y = gmpy2.invert(q,p) z = (y*q*a1+x*p*a2)%n k = (y*q*a1-x*p*a2)%n
def encrypt2(tips, key): ltips = len(tips) lkey = len(key) secret = [] num = 0 for each in tips: if num >= lkey: num = num % lkey secret.append(chr(ord(each) ^ ord(key[num]))) num += 1 return base64.b64encode(''.join(secret).encode()).decode()
def decrypt2(secret, key): tips = base64.b64decode(secret.encode()).decode() ltips = len(tips) lkey = len(key) secret = [] num = 0 for each in tips: if num >= lkey: num = num % lkey secret.append(chr(ord(each) ^ ord(key[num]))) num += 1 return ''.join(secret)
flag = 'IAMrG1EOPkM5NRI1cChQDxEcGDZMURptPzgHJHUiN0ASDgUYUB4LGQMUGAtLCQcJJywcFmddNno/PBtQbiMWNxsGLiFuLwpiFlkyP084Ng0lKj8GUBMXcwEXPTJrRDMdNwMiHVkCBFklHgIAWQwgCz8YQhp6E1xUHgUELxMtSh0xXzxBEisbUyYGOx1DBBZWPg1CXFkvJEcxO0ADeBwzChIOQkdwXQRpQCJHCQsaFE4CIjMDcwswTBw4BS9mLVMLLDs8HVgeQkscGBEBFSpQFQQgPTVRAUpvHyAiV1oPE0kyADpDbF8AbyErBjNkPh9PHiY7O1ZaGBADMB0PEVwdCxI+MCcXARZiPhwfH1IfKitGOF42FV8FTxwqPzBPAVUUOAEKAHEEP2QZGjQVV1oIS0QBJgBDLx1jEAsWKGk5Nw03MVgmWSE4Qy5LEghoHDY+OQ9dXE44Th0=' key = 'this is key'
try: result = input('please input key: ') if result == decrypt2('AAAAAAAAAAAfFwwRSAIWWQ==', key): print(decrypt1(base64.b64decode(decrypt2(flag, result)))) elif result == key: print('flag{0e26d898-b454-43de-9c87-eb3d122186bc}') else: print('key is error.') except Exception: None e = None None try: pass finally: e = None del e
def encrypt2(tips, key): ltips = len(tips) lkey = len(key) secret = [] num = 0 for each in tips: if num >= lkey: num = num % lkey secret.append(chr(ord(each) ^ ord(key[num]))) num += 1 return base64.b64encode(''.join(secret).encode()).decode()
def decrypt2(secret, key): tips = base64.b64decode(secret.encode()).decode() ltips = len(tips) lkey = len(key) secret = [] num = 0 for each in tips: if num >= lkey: num = num % lkey secret.append(chr(ord(each) ^ ord(key[num]))) num += 1 return ''.join(secret)
flag = 'IAMrG1EOPkM5NRI1cChQDxEcGDZMURptPzgHJHUiN0ASDgUYUB4LGQMUGAtLCQcJJywcFmddNno/PBtQbiMWNxsGLiFuLwpiFlkyP084Ng0lKj8GUBMXcwEXPTJrRDMdNwMiHVkCBFklHgIAWQwgCz8YQhp6E1xUHgUELxMtSh0xXzxBEisbUyYGOx1DBBZWPg1CXFkvJEcxO0ADeBwzChIOQkdwXQRpQCJHCQsaFE4CIjMDcwswTBw4BS9mLVMLLDs8HVgeQkscGBEBFSpQFQQgPTVRAUpvHyAiV1oPE0kyADpDbF8AbyErBjNkPh9PHiY7O1ZaGBADMB0PEVwdCxI+MCcXARZiPhwfH1IfKitGOF42FV8FTxwqPzBPAVUUOAEKAHEEP2QZGjQVV1oIS0QBJgBDLx1jEAsWKGk5Nw03MVgmWSE4Qy5LEghoHDY+OQ9dXE44Th0=' key = 'this is key'
try: result = input('please input key: ') if result == decrypt2('AAAAAAAAAAAfFwwRSAIWWQ==', key): print(decrypt1(base64.b64decode(decrypt2(flag, result)))) elif result == key: print('flag{0e26d898-b454-43de-9c87-eb3d122186bc}') else: print('key is error.') except Exception: None e = None None try: pass finally: e = None del e