tracker1 / node-js-scrypt Goto Github PK
View Code? Open in Web Editor NEWJS Implementation of SCrypt wrapped in a module for node.js consumption.
License: BSD 2-Clause "Simplified" License
JS Implementation of SCrypt wrapped in a module for node.js consumption.
License: BSD 2-Clause "Simplified" License
I'm trying to apply this library, but there's an problem.
Compare to other libraries, hash result is totally different.
Here's example code for verification.
const scrypt = require('scrypt');
const jsScrypt = require('js-scrypt');
const scryptsy = require('scryptsy');
const scryptJs = require('scrypt-js');
const salt = 'salt';
const key = 'this is a key';
const N = 16;
const r = 1;
const p = 1;
const dkLen = 64;
const scryptResult = scrypt.hashSync(key, { "N": 16, "r": 1, "p": 1 }, 64, salt);
const jsscryptResult = jsScrypt.hashSync(key, { "N": 16, "r": 1, "p": 1 }, 64, salt);
const scryptsyResult = scryptsy(key, salt, 16,1,1,64);
scryptJs(Buffer.from(key), Buffer.from(salt), N, r, p, dkLen, function (error, progress, key) {
if (error) {
console.log("Error: " + error);
} else if (key) {
console.log("scryptJsResult: " + Buffer.from(key, 'hex').toString('base64'));
}
});
console.log('scryptResult: ' + scryptResult.toString('base64'));
console.log('jsscryptResult: ' + jsscryptResult.toString('base64'));
console.log('scryptsyResult: ' + scryptsyResult.toString('base64'));
// Results
scryptJsResult: /TKDucU/c6nSRo6CABG8vwVnK6MeQGs75y1iFlG9Le/sjJ9bQEAEL+Wwvt8zhhZ7Io2Yb8pzQJcnVlV5V6juaQ==
scryptResult: /TKDucU/c6nSRo6CABG8vwVnK6MeQGs75y1iFlG9Le/sjJ9bQEAEL+Wwvt8zhhZ7Io2Yb8pzQJcnVlV5V6juaQ==
jsscryptResult: 5zaU49mSsd8JzgoUKimk+ci9QjyPFq8pLz0AN5O3PVqQtWgQWZHnHzCW7Fk7Y0NeP3gUW98PKaCcPC65udtFbw==
scryptsyResult: /TKDucU/c6nSRo6CABG8vwVnK6MeQGs75y1iFlG9Le/sjJ9bQEAEL+Wwvt8zhhZ7Io2Yb8pzQJcnVlV5V6juaQ==
Only this library returns a different result.
Are there any option to fix this situation?
I'm looking forward to your answer.
Thank you.
The line:
if (response.error) cb(error);
throws an exception as you are not passing response.error to the callback.
error is undefined.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.