#!/usr/bin/env python3 """ Utility to generate Caesar-shifted ciphertext for the challenge. Usage: python3 generate_cipher.py --text "YOUR PLAINTEXT" --shift 3 """ import argparse ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def caesar_encrypt(text: str, shift: int) -> str: out = [] for ch in text: if ch.isalpha(): is_lower = ch.islower() base = ch.upper() idx = ALPHA.index(base) new_idx = (idx + shift) % 26 new_ch = ALPHA[new_idx] out.append(new_ch.lower() if is_lower else new_ch) else: out.append(ch) return ''.join(out) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--text', required=True) parser.add_argument('--shift', type=int, default=3) args = parser.parse_args() print(caesar_encrypt(args.text, args.shift))