joyent/node — Issue #2227: crypto.createHash only mildly annoyed by invalid digest methods
Author: secoif
Created: 2011-11-30 03:01:09+00:00
State: open

Currently there appears to be no way to determine if the crypto `createHash` function succeeded. If you're in the repl, `createHash` calmly prints a little "node-crypto : Unknown message digest " message, but outside the repl, the first time you hear anything about there being a problem, is when you try to `update` the hash:

```javascript
// repl will print "node-crypto : Unknown message digest md1" but not throw
// and i can't see any difference with the returned object between valid/invalid requests
var shasum = require('crypto').createHash('invalid method')
shasum.update('someDatas') // will throw TypeError: HashUpdate fail

```

`createHash` should probably throw or simply return something falsy.