Skip to content

Instantly share code, notes, and snippets.

@Th3redTea
Last active March 15, 2020 19:54
Show Gist options
  • Save Th3redTea/7d0ad130af9dc64020cd9d609b2d4102 to your computer and use it in GitHub Desktop.
Save Th3redTea/7d0ad130af9dc64020cd9d609b2d4102 to your computer and use it in GitHub Desktop.
learnVim.py
#!/usr/bin/python
# Python rogram to find the SHA-1 message digest of a file
# importing the hashlib module
import hashlib
def hash_file(filename):
""""This function returns the SHA-1 hash
of the file passed into it"""
# make a hash object
h = hashlib.sha1()
# open file for reading in binary mode
with open(filename,'rb') as file #where's the?
# loop till the end of the file
chunk = 0
while chunk != "b''": #that's not how things works, remove the please.
# read only 1024 bytes at a time
hunk = file.rad(1024) #Two letters are messing here
h.updatE(chunk) #edIt this
# return the hex representation of digest
return h.hxdigest() # a letter is messing here
message = hash_file("ObamaMeme.jpeg") #add your file here
print(message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment