我想使用blowfish加密对crypt模块的密码进行散列。你知道吗
在Fedora 29上,我得到了正确的结果:
$ python3.7
Python 3.7.2 (default, Jan 3 2019, 09:14:01)
[GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux
>>> import crypt
>>> crypt.crypt("password", "$2y$08$heregoesasaltstring...")
'$2y$08$heregoesasaltstring...ZR2mMC1niL.pkti1MfmoP.3XVbdoNHm'
>>>
在Ubuntu 18.04上,它不返回任何内容:
$ python3.7
Python 3.7.2 (default, Dec 25 2018, 03:50:46)
[GCC 7.3.0] on linux
>>> import crypt
>>> crypt.crypt("password", "$2y$08$heregoesasaltstring...")
>>>
Fedora上的Python3.7.1来自于默认的repos,而在Ubuntu上,官方repos上的Python3.7.1和我在external PPA上发现的问题都可以看到。你知道吗
是否有任何环境变量或底层程序/库可以改变Python的行为?你知道吗
你的salt字符串在Ubuntu上无效。试着放弃那些美元的标志。你知道吗
从您链接的
crypt
模块的Python文档中:从
man 3 crypt
:我写了一个测试程序来证实这一点:
ubuntu18.04的输出是
我手上没有软呢帽,所以我没试过。您可以复制测试程序并自己编译和运行它。你知道吗
相关问题 更多 >
编程相关推荐