python bytes、str转化

res1 = "LN^dl"
print(binascii.hexlify(bytes(res1,encoding='utf-8')))
# b'4c4e5e646c'
flag2 = int(binascii.hexlify(bytes(res1,encoding='utf-8')),16) ^ 0x20352d1661
print(flag2)
# 465927631373
print(hex(flag2))
# 0x6c7b73720d
flag2 = binascii.unhexlify(hex(flag2)[2:]).decode('utf-8')
print(flag2)
# l{sr

你可能感兴趣的:(python)