hashlib

    4热度

    3回答

    运行在以下mkpasswd -m sha-512 -S salt1234 password结果: $6$salt1234$Zr07alHmuONZlfKILiGKKULQZaBG6Qmf5smHCNH35KnciTapZ7dItwaCv5SKZ1xH9ydG59SCgkdtsTqVWGhk81 我有Python代码这个片段,我认为将输出相同,但并不: import hashlib, base6

    1热度

    1回答

    我不想重新创建可能已经存在的模块。但对programiz解释如何得到一个很好的例子了SHA-1的消息摘要 # Python rogram to find the SHA-1 message digest of a file # import hashlib module import hashlib def hash_file(filename): """"This funct

    1热度

    1回答

    我正在关注一些python书籍,作者提供了一个使用crypt来产生散列密码的例子。使用salt +密码;后来他提到使用hashlib库可以为sha512做同样的事情。所以我试图使用 hashlib.sha512(password+salt).hexdigest() 来查看我是否可以在/ etc/shadow文件中使用相同的密码,但是我没有得到任何类似的东西。我正在使用显示为密码哈希部分的盐。我是否

    0热度

    2回答

    我想比较两个文件的哈希值。但是,不管文件不同或没有,即使有不同的哈希值比较结果真 下面是代码: import hashlib hasher1 = hashlib.md5() afile1 = open('canvas.png', 'rb') buf1 = afile1.read() a = hasher1.update(buf1) print(str(hasher1.hexdigest

    3热度

    1回答

    The Python 2.7 documentation已经这样说了hashlib hashers: hash.update(arg) Update the hash object with the string arg. [...] 但我看到有人给它的对象是不是字符串,例如buffers,numpy ndarrays。 鉴于Python的鸭子打字,我并不感到惊讶,它是可能指定非字

    1热度

    1回答

    我与SIPVicious(蟒蛇)打 所以我有一个专门的服务器的CentOS 6.6。当我运行脚本时,出现此错误: /root/1/fphelper.py:134: DeprecationWarning: the sha module is deprecated; use the hashlib module instead import sha, re 当我使用此命令时。 rpm -qa | gr

    11热度

    3回答

    当我试图在任何情况下导入hashlib,它抛出这个错误: File "<stdin>", line 1, in <module> File "build/bdist.macosx-10.11-intel/egg/hashlib.py", line 115, in <module> """ TypeError: 'frozenset' object is not callabl

    0热度

    1回答

    我正在做一个作业:在dict中,register()函数存储username-md5(密码)对而不是用户名 - 密码对,然后login()函数检查是否有一对用户名密码正确与否。但是,如果我向md5哈希添加'salt',那么login()会有问题:当输入相同时,md5具有不同的返回值。 import hashlib salt = '1ha3' def register (**kw):

    4热度

    1回答

    早上好,全部。 我想将我的社会安全号码转换为md5哈希十六进制数字。结果应该是每个社会安全号码的唯一md5哈希十六进制数字。 我的数据格式如下: ob = onboard[['regions','lname','ssno']][:10] ob regions lname ssno 0 Northern Region (R1) Banderas 123456789 1 Northe

    2热度

    3回答

    我想查找以“10”开头的文件(可能是exe,doc,pdf等)的md5sum,因此不检查文件扩展名,只检查起始两位数。到目前为止,我的脚本通过目录遍历并打印出所有这些文件,但无法得到校验要打印为他们每个人: def print_files(file_directory, file_extensions=['10']): ''' Print files in file_director