我的程序通过SSL向网页发送请求,并在标题中(https://example.com/index.php?clientid=xxxx?spcode=xxxx)是一个管理员密码,用于确定它们是否是有效的客户端在我向他们发送一堆数据之前我的系统.
如果一个流氓员工通过窥探本地SSL数据来获取此密码,那么如果他猜测订单号(不是很难),他可能会发送和接收客户订单.
我知道如何使用bcrypt保护我系统上的某人密码.但是,当其他人使用他们的系统时,如何保护某人的密码?
我知道您不应该发送预先调整过的密码,否则有可能泄露您的盐.我应该使用一些软的临时传输哈希(一个不同于我存储在DB中的哈希).我认为这不是最好的方式,所以我要求大家帮忙.我在Stack Exchange找到了一些很棒的技巧.
每个人都提前感谢您的时间.我期待着你的想法.
是否可以在 java 中使用 bcrypt 进行散列并再次取消散列?甚至有可能吗?我正在尝试一些新的东西,但我对 Unhashing 一无所知(如果可能的话)。如果可能的话,有人能给我举个例子吗?
如果知道密钥,是否有可逆的散列算法?
我在我的Ubuntu系统上安装名为"bcrypt"的npm软件包时遇到问题.
这就是我做的:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install bcrypt
这就是我得到的:
打字时:sudo npm install bcrypt
npm http GET https://registry.npmjs.org/bcrypt
npm http 304 https://registry.npmjs.org/bcrypt
npm http GET https://registry.npmjs.org/bindings/1.0.0
npm http GET https://registry.npmjs.org/nan/1.3.0
npm http 304 https://registry.npmjs.org/nan/1.3.0
npm http 304 https://registry.npmjs.org/bindings/1.0.0
> bcrypt@0.8.0 install /home/gatsu/salongapp/salongapp/node_modules/bcrypt
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack …Run Code Online (Sandbox Code Playgroud) 在我的数据库中,我保存了密码
password_hash($user->getPassword(), PASSWORD_BCRYPT);
Run Code Online (Sandbox Code Playgroud)
在登录表单中,用户输入此密码,我将密码编码为bcrypt字符串,并将加密密码(因为我没有SSL)提交给服务器.
所以我的问题是可以比较用bcrypt生成的两个哈希值吗?
我有一个简单的NodeJS服务器,它使用bcrypt,mysql和socket.IO,它可以作为mysql数据库和聊天服务器的网关.此服务器使用Socket.IO客户端连接到客户端,并使用Socket.IO事件将请求发送到服务器.但是,注册事件会抛出一个Type Error : undefined is not a function.我检查了所有功能,但它们存在,所以我不知道发生了什么.这是我处理注册事件的代码:
socket.on('registration request', function(msg,err) {
var split = msg.toString().split(":§:");
var userName = split[0];
var password = split[1];
var email = split[2];
console.log("Registration request : " + userName + " <===> " + email); //<====== Prints this to the console then crashes and returns the message below
if(err){
console.log("Socket Error !!\n" + err);
}
if (pattern.test(userName) && emailRegex.test(email)) {
console.log("Data is valid. Coding password");
password = bcrypt.hashSync(password.toString(), 2);
console.log("Querying DB");
DBConnection.query(
"INSERT …Run Code Online (Sandbox Code Playgroud) 好的,我正在使用Java与Spring MVC和Hibernate.我是第一次使用bCrypt进行密码加密.据我所知,bCrypt将salt与hash集成在一起.我现在设置它以便密码被接受为输入,用bCrypt编码,并保存是我的SQL数据库的一列.
但是,我想将盐与哈希分开并将它们分开存储.我已经阅读并尝试了很多东西,但找不到办法做到这一点.因此,如果有人能指出我正确的方向,这将是一个很大的帮助.
这就是我目前所拥有的.
这是设置bCrypt的基本代码.它需要我的密码字符串,并加密它.
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
String hashedPassword = passwordEncoder.encode(password);
Run Code Online (Sandbox Code Playgroud)
下面的代码获取密码并将其放入DB中的单个列中.
employee.setPasswordSalt(hashedPassword);
Run Code Online (Sandbox Code Playgroud) 所以我不知道发生了什么,但是对你来说很有趣.如果我这样做
return bcrypt('hello');
exit();
Run Code Online (Sandbox Code Playgroud)
运行3次这是我回来的:
第1名: $2y$10$T11IfKkHIAIXi0SRhjMXKeSQQtze8zBVZnWdlRXfsSdcCXKIq/n7W
第二: $2y$10$DpKVtgbF4OVa3jm.wdG5..jb9AvXsuo2EfqnjuzmsEVCmcOVr5nKq
第三: $2y$10$0.ziFneJu0wrS2b3rHA6kucnGBkS2MRtgfp0gtEb/7ZOCV8dG3Mmq
我很难过.工作在laravel 5.1 - 不知道这是不是我的错.对不起.还有谁有相同的问题吗?它有解决方法吗?
没有多大关系,如果我得到一个答案,5.2是法士特不是很好,我搬回laravel 5.1,因为A)它更稳定,B)之前,泰勒Otwell让吉本斯在项目开发它.虽然我会问,有人遇到过这个问题并将其修复为其他偷看.
我的bcrypt存在问题,我不确定为什么。这是我的基本注册路线代码:
const express = require('express');
const router = express.Router();
const bcrypt = require('bcryptjs');
const passport = require('passport');
// Register
router.post('/register', function(req, res){
req.checkBody('username', 'Username is Required').notEmpty();
req.checkBody('kingname', 'Kingdom Name is Required').notEmpty();
req.checkBody('email', 'E-Mail is Required').notEmpty();
req.checkBody('password', 'Password is Required').notEmpty();
req.checkBody('password2', 'Passwords do not match').equals(req.body.password);
var errors = req.validationErrors();
if(errors) {
res.render('index', {
errors: errors
});
} else {
var newUser = {
username: req.body.username,
kingname: req.body.kingname,
email: req.body.email,
password: req.body.password,
password2: req.body.password2
}
bcrypt.getSalt(10, function(err, salt){
bcrypt.hash(newUser.password, salt, function(err, hash){ …Run Code Online (Sandbox Code Playgroud) 在 Ubuntu 18.04 上设置 nodejs 项目时出现以下错误。安装的 npm 版本是 6.x,安装的 node 版本是 10.x。
bcrypt@3.0.3 install /home/ubuntu/reko_dev/web/backend/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.3/bcrypt_lib-v3.0.3-node-v64-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.3 and node@10.15.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用bcrypt将用户密码与存储的密码进行比较。但是Express给出错误是我在bcrypt.compare之前使用await
这是代码:
app.post ('/users/login', (req, res) => {
const user = users.find(user=> user.name === req.body.user)
if (user == null) {
return res.status(400).send('Can Not find user');
} else {
try{
if ( await bcrypt.compare(req.body.password, user.password)) {
res.send("Success");
} else {
res.send("Incorrect PAssword");
}
} catch {
return res.status(500).send('Some Error has occurred');
}
}
});
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
C:\Data\Ashish\projects\jwtAuthentication\app.js:32
if ( await bcrypt.compare(req.body.password, user.password)) {
^^^^^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3) …Run Code Online (Sandbox Code Playgroud) bcrypt ×10
node.js ×5
hash ×2
java ×2
php ×2
security ×2
encryption ×1
express ×1
hibernate ×1
https ×1
laravel ×1
mean-stack ×1
mysql ×1
npm ×1
npm-install ×1
passwords ×1
socket.io ×1
ubuntu ×1
ubuntu-18.04 ×1