reimplement node-crypto