Guest User

Untitled

a guest
Feb 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #
  2. import hashlib
  3. string_array = ['dappsuni', 'dappsuni live', 'dappsuni live code']
  4.  
  5. for string in string_array:
  6. print('Byte Encoded version of "', string, '" is: ', string.encode())
  7.  
  8. print('Hash of "', string, '" is:', hashlib.sha256(string.encode()).hexdigest(), ' length of hash: ', len(hashlib.sha256(string.encode()).hexdigest()))
  9.  
  10. longish_string = 'this is a very long string which we want to encode and compute the hash'
  11.  
  12. print('Hash of "', longish_string, '" is:', hashlib.sha256(longish_string.encode()).hexdigest(),
  13. ' length of hash: ',
  14. len(hashlib.sha256(longish_string.encode()).hexdigest()))
Add Comment
Please, Sign In to add comment