Skip to content

Instantly share code, notes, and snippets.

@blakek
Created October 28, 2023 00:41
Show Gist options
  • Save blakek/c15af5b4bf29d65e903eaef299bf1e8e to your computer and use it in GitHub Desktop.
Save blakek/c15af5b4bf29d65e903eaef299bf1e8e to your computer and use it in GitHub Desktop.
Fix Node.js 17+ "digital envelope routines::initialization error"
const crypto = require("crypto");
// HACK: Fix Node.js 17+ "digital envelope routines::initialization error"
// https://stackoverflow.com/q/69692842/1130172
const origCreateHash = crypto.createHash;
crypto.createHash = (algorithm, options) => {
const newAlgorithm = algorithm === "md4" ? "md5" : algorithm;
return origCreateHash(newAlgorithm, options);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment