- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我需要使用 scrypt 算法,因为我已经在使用 hashlib,所以我想……为什么不呢?我已经查过了 this它指出 OpenSSL 1.1+ 是必要的。此外,根据 official doc :
hashlib.scrypt(password, *, salt, n, r, p, maxmem=0, dklen=64)
...
Availability: OpenSSL 1.1+.
New in version 3.6.
我确保拥有最新版本的 openssl:
# openssl version
OpenSSL 1.1.1b 26 Feb 2019
我还尝试运行 python3.6 和 python3 (3.4),但都说它们无法导入 scrypt:
# python3.6
Python 3.6.5 (default, Apr 10 2018, 17:08:37)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from hashlib import pbkdf2_hmac
>>> from hashlib import scrypt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'scrypt'
如您所见,pbkdf2_hmac
等其他方法也有效。有什么问题吗?
此外,hashlib.scrypt(password, *, salt, n, r, p, maxmem=0, dklen=64)
中的*
是什么?
最佳答案
我的 mac 正在运行 OpenSSL 1.1.1 2018 年 9 月 11 日
。我用 python3.6 重现了你的导入症状,并发现 scrypt
导入 python3.7 就好了。您可以考虑尝试 3.7。
签名中的*
是比较新的语法这标志着位置参数的结束。所以你不能调用 scrypt('secret', 'mySalt')
。您需要指定关键字参数,例如scrypt(' secret ', salt='mySalt')
.目的是通过使用错误的 arg 顺序更难调用错误。这对于加密 API 尤其重要,其中许多参数不透明且难以验证。
关于Python:无法从 hashlib 导入 scrypt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55366629/
具体this .我知道大多数 bcrypt 实现大约有 50 个字符,但我很确定 scrypt 并非如此。 最佳答案 来自 scrypt 继承者的开发者: ...question that is re
我已经为此苦苦挣扎了一段时间,希望有人以前做过这件事并且可以帮助我。我去找 Firebase 人员请求 scrypt 参数,以便将我们的用户身份验证从 Firebase 迁移到我们自己的服务器。现在我
我正在为只有 32KB 内部存储器的处理器开发 Litecoin Miner。所以我正在研究 SCrypt 算法,对于 Litecoin,它使用 N = 1024,这给我 2^10 * 1 * 128
我使用 Python 3.7.9 从 hashlib 对 scrypt() 进行了以下函数调用: def aes_encrypt(msg, passwordStr): kdfSalt = ur
我需要探测给定的字符串是否与加密 key 匹配。 一些需要匹配的例子: $s0$e0801$epIxT/h6HbbwHaehFnh/bw==$7H0vsXlY8UxxyW/BWx/9GuY7jEvGj
我正在使用 scrypt 算法将密码存储在数据库中,然后存储该字符串。 然后我将进行密码检查,然后对提供的密码进行散列处理,并根据密码进行检查。 我的问题是,我是否想增加比这更多的安全性?我是否也应该
如何使用 scrypt 加密在 java 中使用 KeyPairGenerator 创建的私钥?我想使用密码来保护私钥,这样即使他拥有私钥和数据,也无法使用私钥来解密我加密的数据。(如果您不建议使用其
据我了解最大时间参数: data = scrypt.encrypt('MESSAGE', 'password', maxtime=0.1) 意味着 python 将散列该时间量。 但是,我可以降低到
我不明白我应该如何使用 scrypt 存储散列密码。 例子如下: import pyscrypt hashed = pyscrypt.hash(password = b"password",
我读过 scrypt以及它相对于 bcrypt 的一些优势特定情况下的哈希算法。 无论如何,scrypt 似乎还没有被广泛使用。到目前为止,有没有人见过它的 .NET 实现(在 C# 中很受欢迎)?
我试图在 Go 中模仿 python 库 ( https://pypi.org/project/scrypt/ ) 中可用的功能,用于解密 scrypt 生成的摘要(给定正确的密码)。 似乎 go 库
我正在使用 Java scrypt library用于密码存储。当我加密事物时,它需要一个 N、r 和 p 值,其文档将其称为“CPU 成本”、“内存成本” ”和“并行化成本”参数。唯一的问题是,我实
I have really been struggling trying to get Bouncy Castle Scrypt going in my web app for password
我很确定没有,但我想确认 Bouncy CaSTLe for Java 中的 SCrypt 实现 SCrypt.generate() 是否在结果中包含参数(例如NodeJS 的实现确实如此)。 最佳答
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭10 年前。 Improve th
我正在使用 Bouncy CaSTLe 用 Java 编写一个应用程序,但我仍然希望通过 Java 加密体系结构编写尽可能可移植的代码。是否可以通过JCA访问SCrypt算法? In the li
我正在使用 nodejs 库 scrypt 来哈希我的密码。 scrypt.hash(new Buffer(data.password), scryptParameters, function(err
我需要使用 scrypt 算法,因为我已经在使用 hashlib,所以我想……为什么不呢?我已经查过了 this它指出 OpenSSL 1.1+ 是必要的。此外,根据 official doc : h
我尝试构建一个 python 脚本来从 snmp 传感器获取温度。 如果我在 Linux 终端上使用此命令行 snmpwalk 10.100.2.21 -On -v 1 -c public .1.3.
我一直在努力尝试让 Bouncy CaSTLe Scrypt 在我的网络应用程序中进行密码加密。我对 Java 编程和安全性还很陌生。 我试过查看 Bouncy CaSTLe 的 documentat
我是一名优秀的程序员,十分优秀!