Last active
March 15, 2020 19:54
-
-
Save Th3redTea/7d0ad130af9dc64020cd9d609b2d4102 to your computer and use it in GitHub Desktop.
learnVim.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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