美文网首页我爱编程
Python SHA512加密25000次

Python SHA512加密25000次

作者: 叽翅 | 来源:发表于2018-04-12 18:01 被阅读0次
    # coding:utf8
    """
    --------------------------------------------------------------------------
        File:   hash_sha512.py
        Auth:   zsdostar
        Date:   2018/4/12 17:12
        Sys:    Windows 7
    --------------------------------------------------------------------------
        Desc:   
    --------------------------------------------------------------------------
    """
    __author__ = 'zsdostar'
    
    import hashlib
    
    
    def hyashi(pwd, wheels=0):
        """
        hyashi could hash any times for your request, however 500000 times may spend 1s, it's linear relation of time and times.
        :param pwd: request password.
        :param wheels: sha512 times.
        :return: result after hyashi() the pwd for wheels times.
        """
        pwd = hashlib.sha512(pwd).hexdigest()
        if not wheels:
            return pwd
        for _ in xrange(wheels):
            pwd = hashlib.sha512(pwd).hexdigest()
        return pwd
    
    
    if __name__ == '__main__':
        print hyashi('', 25000)
    
    

    相关文章

      网友评论

        本文标题:Python SHA512加密25000次

        本文链接:https://www.haomeiwen.com/subject/emsfkftx.html