Boss

Boss: The Cipher Sphinx

The boss
Boss Fight!
Every passing test breaks a shield.

Deep under Lantern Harbor lies the Signal Vault. Its door is guarded by the Cipher Sphinx, who speaks only in riddles.

"Bring me my riddle's answer," she purrs, "and prove it is true."

She hands you a packet of letters and a long fingerprint. The packet is wrapped in base64. Inside is a shift cipher with an unknown key. The fingerprint is the SHA-256 of the real message, so you can prove you cracked it correctly.

Assignment

shift_text and score are ready for you.

  1. unwrap(packet) opens the base64 envelope: decode the packet with base64.b64decode and return it as UTF-8 text.
  2. crack(secret, words) tries all 26 keys (key k decodes with shift_text(secret, -k)) and returns the best-scoring message. On a tie, keep the smallest key.
  3. fingerprint(text) returns the SHA-256 hex digest of the text's UTF-8 bytes.
  4. open_vault(packet, words, seal) unwraps and cracks the packet. If the message's fingerprint equals seal, return the message. Otherwise return "The Sphinx shakes her head."
  5. Print open_vault(PACKET, WORDS, SEAL).

These are learning tools, not real protection. Real secrets need real encryption, written and checked by security experts.