Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- import hashlib
- string_array = ['dappsuni', 'dappsuni live', 'dappsuni live code']
- for string in string_array:
- print('Byte Encoded version of "', string, '" is: ', string.encode())
- print('Hash of "', string, '" is:', hashlib.sha256(string.encode()).hexdigest(), ' length of hash: ', len(hashlib.sha256(string.encode()).hexdigest()))
- longish_string = 'this is a very long string which we want to encode and compute the hash'
- print('Hash of "', longish_string, '" is:', hashlib.sha256(longish_string.encode()).hexdigest(),
- ' length of hash: ',
- len(hashlib.sha256(longish_string.encode()).hexdigest()))
Add Comment
Please, Sign In to add comment