Here's an example:
'use strict';functionsha256(buf){returncrypto.createHash('sha256').update(buf).digest('hex');}varcrypto=require('crypto');varsecret='my special secret';varappPbkdf2Salt=sha256(newBuffer("MY_SALT"));variterations=1000;varbitLength;// oops, forgot to define bit lengthvarkeyByteLength=bitLength/8;varhashname='sha256';crypto.pbkdf2(secret,appPbkdf2Salt,iterations,keyByteLength,hashname,function(err,bytes){if(err){throwerr;}console.log('bytes',bytes.toString('hex'));});I'm assuming that NaN is coerced to 0. I would think that 0 should also throw an error.
Here's an example:
I'm assuming that NaN is coerced to 0. I would think that 0 should also throw an error.