Answers for "how to encrypt a file python sha256"

1

python sha256 of file

# Python program to find SHA256 hash string of a file
import hashlib
 
filename = input("Enter the input file name: ")
sha256_hash = hashlib.sha256()
with open(filename,"rb") as f:
    # Read and update hash string value in blocks of 4K
    for byte_block in iter(lambda: f.read(4096),b""):
        sha256_hash.update(byte_block)
    print(sha256_hash.hexdigest())
Posted by: Guest on January-10-2021
0

encrypt password with sha512 + python

python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)))'
Posted by: Guest on January-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language