As we've seen in earlier posts, you can create an SHA256 hash of a string and generate a hash in string type or let's say a case where you are using it on a file.
In the code below, we are going to encode the bytes-like object
a.digest() using Base64 and return a bytes object which will be stored in the variable
import hashlib import base64 a = hashlib.sha256('your string or password'.encode('utf8')) b = base64.b64encode(a.digest()).decode() print(b)
The output of the above code will be a base64 string-
I'm glad that you found this article to create a base64 string out of SHA-256 hash useful. Happy Coding.