AGRL112: Introduction to Major in CSE

(IIT Delhi - Abu Dhabi)

[Assignment-3 (Security & privacy)]

Charles Dickens has managed to use time travel to come to our current times, and he is shocked to see that his novel "Great Expectations" is floating freely on the internet, and people are claiming ownership and tampering with various portions of his beloved novel. He has a new novel, "Greater Expectations" and he wants to ensure that the same does not happen with his new novel. He comes to know about a very cool crypto tool called Collision Resistant Hash Function (CRHF) that can be used for this. (Here is a write-up about CRHF that I wrote some time back that you may find useful). One popular CRHF is the SHA-256 algorithm.

SHA-256 is a cryptographic hash function that creates a unique, fixed-size "fingerprint" for any given digital file or data. It is excellent for verifying data integrity and data authenticity in copyright contexts, allowing you to prove a document's original state and detect any alterations. However, SHA-256 itself does not grant copyright; copyright is a legal status granted by law. To use it for copyright, you would create a SHA-256 hash of your work and keep a record of it, along with its creation date, to use as evidence if your copyright is ever infringed upon.

How SHA-256 Works for Copyright:

  • Create a Unique Hash: You run your digital work (text, image, document) through the SHA-256 algorithm to generate a unique, 256-bit hash value.
  • Record the Hash and Date: You then securely store this hash value along with the date and time it was generated.
  • Evidence of Original Creation: This record serves as strong evidence that you possessed the exact version of the work at that specific time.
  • Detecting Infringement: If someone later claims to have created the same work or if your work is used without permission, you can compare the hash of their work or the original file to your recorded hash. Any discrepancy indicates that their version is not the original, or that your original file has been altered.

Charles Dickens decides to try out this idea. He plans to create a 256-bit hash of the first paragraph of "Greater Expectations" using the SHA-256 on this paragraph and then publishing the 256 bits within an advertisement in the next day's newspaper. Unfortunately, the newspaper editor says that with Charles's limited budget, the newspaper can only publish 8 bits. So, Charles decides to publish the first 8 bits of the 256-bit hash. To test the security of this protocol, Charles has contacted Prof. Vireshwar and Prof. Ragesh, and asked them to pose a challenge to the AGRL112 class at IIT Delhi - Abu Dhabi, since he heard very good things about the students in the class about how they cracked a substitution cipher on Great Expectations. Charles Dickens uses the following Python code to create an 8-bit hash that is published in the newspaper.

In [18]:
import hashlib

# Paragraph to be hashed
paragraph = """My full name is Philip Pirrip, but when I was little I couldn’t say it properly. 
The best I could manage was “Pip,” and that’s the name that stuck. Everyone’s called me that ever since."""

# Uses the SHA-56 implementation in Python to create the 32-bytes of the hash (i.e., 256-bits)
h = hashlib.sha256(paragraph.encode()).digest()

# The first 8-bits of the hash is what is printed in the newspaper
string_to_print = "{:08b}".format(h[0])
print("String to print in the newspaper:", string_to_print)
String to print in the newspaper: 10000000

Your challenge is to find another paragraph that is different from the one written by Charles but that has the same 8-bit hash value (i.e., 10000000). If you manage to do so, then the integrity and authenticity of Greater Expectations is compromised, and Charles will have to think of some other method (for example, increasing the budget to print all the 256 bits instead of only the first 8 bits.)

Task: Your task is to submit a paragraph that has the 8-bit hash value 10000000 on Gradescope.

In [ ]: