ericelliott / credential

Easy password hashing and verification in Node. Protects against brute force, rainbow tables, and timing attacks.
MIT License
348 stars 28 forks source link

Why hash() just return string rather than object? #52

Closed moslemezzati closed 8 years ago

moslemezzati commented 8 years ago

First of all many thanks for your lib, I have a problem to work with your module. when I use hash() it returns a string that has a object for example

pw.hash(body.password, function (err, hash) {
      if (err) {
        console.error(err);
        return;
      }
console.log(type of hash) // string
}

but I need hash.hash

ericelliott commented 8 years ago

It returns a string for database storage and retrieval. The verify function validates using the string. If you need to access the object, you can do so by converting the string to an object with JSON.parse(string).

tjconcept commented 8 years ago

You might want to see #46