请帮我弄清楚为什么我无法在运行 ubuntu 14.04 的系统中安装 bcrypt
错误 :
somehostname@somehost:~$ pip install bcyrpt
Collecting bcyrpt
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections …Run Code Online (Sandbox Code Playgroud) 我正在使用 Spring Framework(-> Java)构建一个 Web 应用程序。出于测试原因,我创建了一个用户(通过 SQL 语句)。目前我正在研究密码加密,为此我使用 BCyrptPasswordEncoder。我想知道是否可以使用编码密码创建第一个用户。
换句话说:我可以通过 SQL 语句使用加密密码作为输入来创建新用户吗?如果是这样,我该如何输入编码密码?
我尝试过 {Bcyrpt}[hash],我在一些网站上读到过,但这似乎不起作用......
插入用户(用户名,密码)值('admin','passwd')
I'm trying to call Ansible's password_hash function thusly...
{{ admin_password | password_hash('bcrypt') }}
Run Code Online (Sandbox Code Playgroud)
and I've tried a dozen ways to tell Ansible where passlib and python 2.7 are but no matter what, I'm continuously getting the result...
"AnsibleFilterError: crypt.crypt does not support 'bcrypt' algorithm"
Run Code Online (Sandbox Code Playgroud)
From what I can see, ansible used to only use crypt, but newer versions (I'm currently on 2.7.9) use passlib when it's there and passlib supports bcrypt as far as I understand (which is limited). …
我正在使用bcryptjs包来散列和比较密码。
下面使用的方法compareSync是同步的并返回一个布尔值。它可靠且按预期工作。
let trueOrFalse = bcrypt.compareSync('abcd', '1234');
if(trueOrFalse) {
console.log('hooray, it was true');
} else {
console.log('oops, it was false');
}
Run Code Online (Sandbox Code Playgroud)
下一个示例使用异步compare方法。我担心,因为这个版本是异步的,如果服务器上有任何延迟,它可能会在确定 的值if/else之前到达语句。这是一个合理的担忧还是我误解了这种类型的异步函数的本质?bcrypt.compareres
let trueOrFalse;
bcrypt.compare('abcd', '1234', function(err, res) {
trueOrFalse = res;
}
if(trueOrFalse) {
console.log('hooray, it was true');
} else {
console.log('oops, it was false');
}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个基于 NodeJS 和 ReactJS 的 Web 应用程序,其中我尝试对多个路由中的密码进行哈希处理,一个用于注册,另一个用于更改密码。
为此,我在两条路线之外生成盐,因此它们都使用相同的盐,如下所示:
const salt = bcrypt.genSalt(10);
Run Code Online (Sandbox Code Playgroud)
现在在路由内部,生成如下:
user.password = await bcrypt.hash(newPassword, salt);
Run Code Online (Sandbox Code Playgroud)
但是当我运行它时,它给出以下控制台错误:
非法参数:字符串、对象
当我在各个路由内生成盐时,哈希操作运行良好。可能是什么原因?
const bcrypt = require('bcrypt')
const hash = bcrypt.hash(<myPassword>, 12)
const hashSync = bcrypt.hashSync(<myPasword>, 12)
Run Code Online (Sandbox Code Playgroud)
它们可能在哪些方面有所不同?它们可以互换使用吗?(非常欢迎并非常感谢详细的解释!)
运行时:gem install bcrypt-ruby -v '3.0.1'我收到以下错误:
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
current directory: /U/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-ruby-3.0.1/ext/mri
/U/.rbenv/versions/2.7.2/bin/ruby -I /U/.rbenv/versions/2.7.2/lib/ruby/2.7.0 -r ./siteconf20210824-80693-sdyma7.rb extconf.rb
creating Makefile
current directory: /U/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-ruby-3.0.1/ext/mri
make "DESTDIR=" clean
current directory: /U/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-ruby-3.0.1/ext/mri
make "DESTDIR="
compiling bcrypt_ext.c
bcrypt_ext.c:27:19: error: implicit declaration of function 'ruby_bcrypt' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return (VALUE)ruby_bcrypt(args->output, args->key, args->salt);
^
bcrypt_ext.c:27:19: note: did you mean 'ruby_script'?
/U/.rbenv/versions/2.7.2/include/ruby-2.7.0/ruby/ruby.h:2747:6: note: 'ruby_script' declared here
void ruby_script(const …Run Code Online (Sandbox Code Playgroud) 我需要为Bcrypt生成盐,我试图了解我的PRNG需要多少随机,因为盐不会太弱以至于无法使用Bcrypt.我有五种一般的随机来源:
Math::Random::Secure/dev/urandom/dev/random/dev/random我认为这个代码运行的机器已经太难了(当机器忙时,/proc/sys/kernel/random/entropy_avail低于500),否则这将是一个非问题,我只会使用/dev/random.也就是说,如果它足够重要,我将继续使用/dev/random/(人们不会经常设置新的密码).
我正在使用PBKDF2,但这同样适用于BCrypt.
以合理的迭代次数散列密码可以轻松阻止0.5秒.什么是轻量级的方法来解决这个问题?我不愿意为此操作设置像Celery或Gearman这样的东西.
实际上,似乎基准测试设置不正确,我遵循了用户@Luke Joshua Park 共享的资源,现在可以使用了。
package main
import "testing"
func benchmarkBcrypt(i int, b *testing.B){
for n:= 0; n < b.N; n++ {
HashPassword("my pass", i)
}
}
func BenchmarkBcrypt9(b *testing.B){
benchmarkBcrypt(9, b)
}
func BenchmarkBcrypt10(b *testing.B){
benchmarkBcrypt(10, b)
}
func BenchmarkBcrypt11(b *testing.B){
benchmarkBcrypt(11, b)
}
func BenchmarkBcrypt12(b *testing.B){
benchmarkBcrypt(12, b)
}
func BenchmarkBcrypt13(b *testing.B){
benchmarkBcrypt(13, b)
}
func BenchmarkBcrypt14(b *testing.B){
benchmarkBcrypt(14, b)
}
Run Code Online (Sandbox Code Playgroud)
输出:
BenchmarkBcrypt9-4 30 39543095 ns/op
BenchmarkBcrypt10-4 20 79184657 ns/op
BenchmarkBcrypt11-4 10 158688315 ns/op
BenchmarkBcrypt12-4 …Run Code Online (Sandbox Code Playgroud)