CSE 107 Homework 4

This homework is due Monday, July 28, at 23:59.

Part 1: Encrypt2Me (aka public-key buggycrypt)

The Encrypt2Me™ library lets you encrypt messages to me: my public key is hardcoded into it, so that anyone can encrypt, but only I can decrypt. At least that's the hope, but unfortunately Encrypt2Me turns out not to be secure!

Here's an example ciphertext (encoded as hex):
4ad87ae9b4f9689022cacc7b6f91f3180bcd881fa5b0b079082f51a01c8e905452a09ea3a3825bd20f86bd4c43e084f575bcfc0dd78d8bac4dbf5bf3582a0b0dff2cb935651ef95b641643afa16a2c644bd1cf259770e30836a7f206036879d24fd7c09fa30bef372bc8573ecb5815a61273f7c2d605a0c4bbd56e82eaf558a26a10437d49f4afd6f77466a45111dbd663f87af0b6d970e6dc3fd06167534009aeb560423ec93689ef556974a57dbb7aea4555c93137fe79569801ff888b5ab169d3b80159c57f1f0c2b7c9486e0b6f2857fe0ea93de3cc39764fb75ed76e808d2aab999363886e702cdd60e462b10acf2a298eaa9e205a6d1ce2919e3c2a6d4fe614077d83b0daa7f3a33b03fba7742ef27d239b6f493cdd07560a0d08297ccb71306bd04cda7da9608ab1168f3959db5dfe13f0e4a3e8f4dbb4270fc78d08ee80f91ade384cb1425037201b34e915dcfdfa9919fa25801b79c54f61a1b59d9dd1f9cd91d50ba527f876eaaeb5c1c0a339ba5161e67e1e4c2be3e6707d0eaed26f9dbe4d8eb3b943d9cc6c7f70664c3b97550d4ae5113202463f253137420bb1ee04523b15c87c4333b89117e838ba050a938428bc5d0056e14c6cea1463fc6596a10a3321644b5b52b26e931341bd4d1f85d3d3ee5681a88609e7041b41129a35bed7c1c5d

Your task is to write code that can break the encryption and extract the underlying message given a ciphertext (like the one above).

Download encrypt2me.py and hw4.py Python files to the same place, and fill in the appropriate functions in hw4.py. Feel free to come to office hours or post on piazza if you have questions or are stuck!

This part is worth 10 points.

Part 2: Short Answer

This part is entirely on gradescope and is worth 10 points.