Skip to content

Instantly share code, notes, and snippets.

@shrinandj
Last active February 23, 2017 23:56
Show Gist options
  • Save shrinandj/ad67c99124d057856a2e82ce7687ed40 to your computer and use it in GitHub Desktop.
Save shrinandj/ad67c99124d057856a2e82ce7687ed40 to your computer and use it in GitHub Desktop.
Python script to verify #shattered
#!/usr/bin/python2.7
import urllib2
import hashlib
# Get shattered-1
response = urllib2.urlopen('https://shattered.it/static/shattered-1.pdf')
shattered_1 = response.read()
# Get shattered-2
response = urllib2.urlopen('https://shattered.it/static/shattered-2.pdf')
shattered_2 = response.read()
# Are they lying?
shattered_1_sha = hashlib.sha1(shattered_1)
shattered_2_sha = hashlib.sha1(shattered_2)
print("Sha1:")
print(shattered_1_sha.hexdigest())
print(shattered_2_sha.hexdigest())
if shattered_1_sha.hexdigest() == shattered_2_sha.hexdigest():
print("Really shattered!")
else:
print("Internet is full of lies!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment