base32/64&base64变表加解密

base32加密

import base64
enc = 'Re__Point'
m = str(base64.b32encode(enc.encode()))
print(m)
# b'KJSV6X2QN5UW45A='

base32解密

import base64
enc = b'KJSV6X2QN5UW45A='
m = str(base64.b32decode(enc))
print(m)
# b'Re__Point'

base64加密

import base64
enc = 'Re__Point'
m = str(base64.b64encode(enc.encode()))
print(m)
# b'UmVfX1BvaW50'

base64解密

import base64
enc = b'UmVfX1BvaW50'
m = str(base64.b64decode(enc))
print(m)
# b'Re__Point'

变表base64解密

import base64
# 原表
origin = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
# 变表
base = 'yzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/abcdefghijklmnopqrstuvwx'
# 密文
c = '1ovhXETgZUDgXFS='
# 映射表
table = str.maketrans(base,origin)
# 明文
m = str(base64.b64decode(c.translate(table)),encoding=('utf-8'))
print(m)

你可能感兴趣的:(CTF,python)