lib: use createFactory to create constructor
I think these code lines are unnecessary, so I use a factory function to generate them
https://github.com/nodejs/node/blob/f53a2414474c2b1aee07ab367415b32c20e50bd9/lib/crypto.js#L104-L148
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines