somepeople

python模块之hashlib

import hashlib
#md5
target = hashlib.md5()
target.update(b'hello world ')
print(target.hexdigest())
#60c08e2b03b716a176aeb9c2a2fddb79


#sha_256
sha_256 = hashlib.sha256()
sha_256.update(b'hello world')
print(sha_256.hexdigest())
#b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9



#sha_512
sha_512 = hashlib.sha512()
sha_512.update(b'hello world')
print(sha_512.hexdigest())
#309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f

 

posted on 2020-07-28 23:43  Hello_Thanos  阅读(70)  评论(0编辑  收藏  举报

导航