python sha256加密

import hashlib

def sha256_encrypt(data):
    sha256 = hashlib.sha256()
    sha256.update(data.encode('utf-8'))
    return sha256.hexdigest()

data = "Hello, world!"
encrypted_data = sha256_encrypt(data)
print(encrypted_data)

 

posted @ 2023-03-16 22:17  myrj  阅读(199)  评论(0编辑  收藏  举报