草庐IT

py-bcrypt

全部标签

java - 我需要用 bcrypt 存储盐吗?

bCrypt'sjavadoc有如何加密密码的代码:Stringpw_hash=BCrypt.hashpw(plain_password,BCrypt.gensalt());要检查明文密码是否与之前已散列的密码匹配,请使用checkpw方法:if(BCrypt.checkpw(candidate_password,stored_hash))System.out.println("Itmatches");elseSystem.out.println("Itdoesnotmatch");这些代码片段对我来说意味着随机生成的盐被丢弃了。是这样吗,还是这只是一个误导性的代码片段?

python - setuptools setup.py 文件中 install_requires kwarg 的引用 requirements.txt

我有一个与Travis-CI一起使用的requirements.txt文件。在requirements.txt和setup.py中重复要求似乎很愚蠢,所以我希望将文件句柄传递给install_requiressetuptools.setup中的kwarg。这可能吗?如果是这样,我应该怎么做?这是我的requirements.txt文件:guessit>=0.5.2tvdb_api>=1.8.2hachoir-metadata>=1.3.3hachoir-core>=1.3.3hachoir-parser>=1.3.4 最佳答案 从表

python - 无法使用 PIP 和 setup.py 安装 Python Cryptography 包

当我尝试安装Cryptography通过pipinstallcryptography或从theirsite下载包的Python包并运行pythonsetup.py,我得到以下错误:D:\Anaconda\Scripts\pip-script.pyrunon02/27/1416:13:17Downloading/unpackingcryptographyGettingpagehttps://pypi.python.org/simple/cryptography/URLstosearchforversionsforcryptography:*https://pypi.python.org/

python - 什么是__main__.py?

__main__.py文件是做什么用的,我应该在其中放入什么样的代码,什么时候应该有一个? 最佳答案 通常,Python程序通过在命令行上命名.py文件来运行:$pythonmy_program.py您还可以创建一个包含代码的目录或zip文件,并包含一个__main__.py。然后你可以在命令行中简单地命名目录或压缩文件,它会自动执行__main__.py:$pythonmy_program_dir$pythonmy_program.zip#Or,iftheprogramisaccessibleasamodule$python-mm

python - "pip install unroll": "python setup.py egg_info" failed with error code 1

我是Python新手,一直在尝试使用pip安装一些软件包。但是pipinstallunroll给了我Command"pythonsetup.pyegg_info"failedwitherrorcode1inC:\Users\MARKAN~1\AppData\Local\Temp\pip-build-wa7uco0k\unroll\我该如何解决这个问题? 最佳答案 关于错误代码根据thePythondocumentation:Thismodulemakesavailablestandarderrnosystemsymbols.Thev

python - 即使使用 __init__.py 如何修复 "Attempted relative import in non-package"

我正在尝试关注PEP328,目录结构如下:pkg/__init__.pycomponents/core.py__init__.pytests/core_test.py__init__.py在core_test.py我有以下导入语句from..components.coreimportGameLoopEvents但是,当我运行时,我收到以下错误:tests$pythoncore_test.pyTraceback(mostrecentcalllast):File"core_test.py",line3,infrom..components.coreimportGameLoopEventsV

python setup.py 卸载

我已经用pythonsetup.pyinstall安装了一个python包。如何卸载它? 最佳答案 注意:避免使用pythonsetup.pyinstall使用pipinstall.您需要手动删除所有文件,并撤消安装手动执行的任何其他操作。如果您不知道所有文件的列表,可以使用--record选项重新安装它,然后查看生成的列表。要记录已安装文件的列表,可以使用:pythonsetup.pyinstall--recordfiles.txt一旦您想卸载,您可以使用xargs进行删除:xargsrm-rf或者,如果您运行的是Windows,

python - 在 setup.py 中清理构建目录

如何让我的setup.py预删除和后删除构建目录? 最佳答案 是否this回答问题?IIRC,您需要使用--all标志来摆脱build/lib之外的东西:pythonsetup.pyclean--all 关于python-在setup.py中清理构建目录,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1594827/

python - MANIFEST.in 在 "python setup.py install"上被忽略 - 没有安装数据文件?

这是我精简后的setup.py脚本,其中删除了非代码内容:#!/usr/bin/envpythonfromdistutils.coreimportsetupfromwhyteboard.miscimportmetasetup(name='Whyteboard',version=meta.version,packages=['whyteboard','whyteboard.gui','whyteboard.lib','whyteboard.lib.pubsub','whyteboard.lib.pubsub.core','whyteboard.lib.pubsub.utils','why

python - __init__.py 是干什么用的?

什么是__init__.py在Python源目录中? 最佳答案 它曾经是包的必需部分(old,pre-3.3"regularpackage",而不是newer3.3+"namespacepackage")。Here'sthedocumentation.Pythondefinestwotypesofpackages,regularpackagesandnamespacepackages.RegularpackagesaretraditionalpackagesastheyexistedinPython3.2andearlier.Are