Coder Social home page Coder Social logo

node-js-scrypt's Issues

Hash result is different from scrypt library.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.