title: How to Decrypt an encrypted Password in Node.js
body: <p>I want to create a change password page for user. I encrypt the password when I save the user in Database (mongodb).</p>
  <pre><code>User.virtual('password')
      .set(function(password) {
        this._password = password;
        this.salt = this.makeSalt();
        this.hashed_password = this.encryptPassword(password);
      })
      .get(function() { return this._password; });
  
    User.method('authenticate', function(plainText) {
      return this.encryptPassword(plainText) === this.hashed_password;
    });
    
    User.method('makeSalt', function() {
      return Math.round((new Date().valueOf() * Math.random())) + '';
    });
  
    User.method('encryptPassword', function(password) {
      return crypto.createHmac('sha1', this.salt).update(password).digest('hex');
    });
  </code></pre>
  <p>I don't know how to decrypt it in order to get the original password back. any help will be appreciated.</p>