python hashlib MD5值计算

def get_md5(str):
    """
    Gets the MD5 value of the specified string
    :param str:the specified string
    :return:the MD5 value
    """
    fd = hashlib.md5()
    msg = '{}'.format(str)
    # print("数据区:",msg)
    fd.update(msg.encode("utf8"))
    return fd.hexdigest()

猜你喜欢

转载自blog.csdn.net/dance117/article/details/92803697