defcaesar_encrypt(text, shift): result = "" for char in text: if char.isalpha(): base = ord('A') if char.isupper() elseord('a') result += chr((ord(char) - base + shift) % 26 + base) else: result += char return result
# 原始 flag flag = "flag{novSVNs9nMuwzLNzhZ28jce3NcYSRJ2EhepoxhLJSjrCTvHZQOqmFu}"
defcaesar_decrypt(text, shift): result = "" for char in text: if char.isalpha(): base = ord('A') if char.isupper() elseord('a') result += chr((ord(char) - base - shift) % 26 + base) else: result += char return result