title: How to fix crypto.pbkdf2 error on node.js
body: <p>I'm attempting to add the crypto.pbkdf2 to my system and I keep returning a digest issue when using mocha to test the various functionalities. My code for the hash method is:</p>
  
  <pre><code>Account.prototype.hashPassword = function (password, salt, callback) {
  // we use pbkdf2 to hash and iterate 10k times by default 
   var iterations = 10000,
      keylen = 64; //64 bit.
  this.crypto.pbkdf2(password, salt, iterations, keylen,'sha1', callback);
  };
  </code></pre>
  
  <p>I've tried to change the digest ('sha1') to many things, including 'shah256', 'null' or digest. But my tests are still failing with the error:</p>
  
  <pre><code> TypeError [ERR_INVALID_ARG_TYPE]: The "digest" argument must be one of type string or null. Received type undefined
    at check (internal/crypto/pbkdf2.js:56:13)
    at Object.pbkdf2Sync (internal/crypto/pbkdf2.js:45:5)
    at UserMock.seedUsers (test\user-mock.js:32:39)
    at Context.&lt;anonymous&gt; (test\account-test.js:296:27)
  </code></pre>
  
  <p>How do I solve the error I am facing?</p>