pbkdf2
pbkdf2 copied to clipboard
The value "NaN" is invalid for option "size"
https://github.com/calvinmetcalf/crypto-pouch/issues/75 - using that package, got error, investigated and found that for some reason digest argument on the other side become fully capitalized, which in turn make package failed to get size of corresponding digest in sync-browser.js file:
var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
as alg === 'SHA-256', sizes['SHA-256'] is undefined, so result sum is NaN.
So this should raise a helpful error message when you input an unsupported digest string? In the sync version only those strings are supported with no aliases:
var sizes = {
md5: 16,
sha1: 20,
sha224: 28,
sha256: 32,
sha384: 48,
sha512: 64,
rmd160: 20,
ripemd160: 20
}
Thanks, I think that explains it.