python - python 使用 concurrent.futures 库进行 SHA256 + salt 加密
问题描述
我有一个加密函数,它不断计算具有恒定盐值和不同 pwd 字段的新派生哈希,该字段是一个字符串。
def EncyptPrimary(salt, pwd):
dkey = hashlib.pbkdf2_hmac('sha256', pwd, salt, 100000, dklen=32)
return str(binascii.b2a_hex(dkey))
我想使用 concurrent.futures 库跨多个 CPU 运行此功能。
executor.map() 的所有文档都混淆了他们如何让它工作。我试过了。
with concurrent.futures.ProcessPoolExecutor() as executor:
executor.map(EncyptPrimary(salt, pwd))
但它抛出一个错误说,不能使用类型生成器。
解决方案
推荐阅读
- php - 每 4 个 div 包裹在一个 div 中
- python - 雪花 SQL 安装期间的错误
- asp.net-core - 全球防伪令牌验证问题
- c# - Plesk 网站中的 Hangfire 重复作业无法正常工作
- javascript - IE11 - 无法添加第二个 optgroup 来选择
- android - 应用停止 android studio 时清除通知
- reactjs - 反应公用文件夹的使用 - 何时使用它以及它是如何工作的?
- typescript - 如何访问非导出命名空间中的接口?
- javascript - 如何创建 jsonpath 以获取 json 的第一部分?
- python - 检查格式错误的字符串中的基本关键字和相关关键字