python之hashlib模块

from hashlib import md5, sha512


# from _hashlib import HASH


def main():
    # md = md5()
    md = sha512()
    # print(type(md), md)
    md.update('zxl'.encode())
    md.update('hhu'.encode())
    result = md.hexdigest()
    print(type(result), result)
    # result=md.digest()
    # print(type(result), result)


def main2():
    # md = md5()
    md = sha512()
    md.update('zxlhhu'.encode())
    result = md.hexdigest()
    print(type(result), result)


if __name__ == '__main__':
    main()
    main2()

 

posted on 2017-09-23 14:39  靖康耻  阅读(151)  评论(0编辑  收藏  举报

导航