Comments (6)
I suspect the error occurs because compareSync(string,hash) takes string as the first argument and hash as the second. I suspect since hash should have considerably longer (and fixed) length, that's where the error occurs.
from bcrypt-nodejs.
Thanks for the reply. After 4 days, I found it's a mongoose issue... Sorry for this. You can close now
from bcrypt-nodejs.
@jackalsin I read that issue and couldn't figure out what the verdict was. From what I see, bcrypt.hashSync
returns a string.
var query = {
'users._id': user_id
};
var update = {
'$set': {
'users.$.password': str
}
};
Why would this be an issue? Can you please explain what you did to resolve the issue?
var bcrypt = require('bcrypt-nodejs');
var salt = bcrypt.genSaltSync();
var hash = bcrypt.hashSync('foofoo', salt);
console.log(typeof hash);
console.log(hash);
string
$2a$10$L0YOhVWpAtDZg0nBnR9EsOKnVIt/eEzGwnlpaA1Ok0DDfaU6H4EV6
from bcrypt-nodejs.
I am having the same issue... how is hash not a string?
from bcrypt-nodejs.
You can console.dir(the_obj_you_want_hash). Mongoose has changed the api. Dir the object.
from bcrypt-nodejs.
Fixed. Thanks
from bcrypt-nodejs.
Related Issues (20)
- Error while installing HOT 1
- node-gyp is required? HOT 1
- Did you plan a release?
- bcrypt compare returns false all the time HOT 4
- Error: global leak detected: lr HOT 7
- Salt in final hash result HOT 1
- Latest version is not published HOT 3
- package.json license field
- The link to github in package.json is wrong HOT 1
- Callback required error when hashing with 3 params HOT 2
- Use strict mode not working HOT 3
- RHEL6 wont compile no c++11 available HOT 2
- npm links to wrong repository HOT 9
- Standardized license HOT 3
- Rounds not optional in bcrypt.genSalt function HOT 1
- Not a valid BCrypt hash.
- hashSync broken, "TypeError: salt.charAt is not a function" HOT 2
- "Octal literal in strict mode" error in Webpack HOT 1
- Please mark the npm package / this project as deprecated HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bcrypt-nodejs.