Node.js ERR_OSSL_EVP_UNSUPPORTED: Causes and Fixes
If crypto.createHash('md4') stops with Error: error:0308010C:digital envelope routines::unsupported (code: 'ERR_OSSL_EVP_UNSUPPORTED'), the cause is that the OpenSSL 3 bundled with Node.js disables md4 by default. If the code is yours, switch to sha256 or another supported algorithm. If the error comes from a webpack 4 build, either upgrade webpack to 4.47.0 or later on Node.js 18 or later, or move to webpack 5.61.0 or later. Either change makes the error go away.
Even if you never call md4 yourself, building an old webpack 4 project on Node.js 17 or later can produce the same error. I reproduced it on three Node.js versions, both with a short script that uses md4 and with a webpack 4 build. I confirmed the error messages and that the error disappears after each fix.
I tested on Ubuntu 24.04 (x86_64) with Node.js 16.20.2 (OpenSSL 1.1.1v), 22.23.4 (OpenSSL 3.5.9), and 24.22.1 (OpenSSL 3.5.9). The 16.20.2 build is the Linux binary distributed from nodejs.org. The npm packages were webpack 4.46.0 and 4.47.0 (webpack-cli 4.10.0) and webpack 5.112.2 (webpack-cli 5.1.4). I did not test Windows or macOS, Node.js 17 to 21 or 23.x, tools that bundle webpack internally such as Create React App or Vue CLI, or the same error caused by old ciphers other than md4.
- 1. The error when hashing with md4
- 2. The cause: OpenSSL 3 removed md4 from the defaults
- 3. Fix 1: change to sha256 or another supported algorithm in your own code
- 4. Fix 2: upgrade webpack if the error comes from a webpack 4 build
- 5. Fix 3: if you cannot upgrade right away, add –openssl-legacy-provider
The error when hashing with md4
I wrote a hash.js that only prints the md4 hash of the string hello.
const crypto = require('node:crypto');
console.log(crypto.createHash('md4').update('hello').digest('hex'));
Running it on Node.js 22.23.4 stopped with the following output (exit code 1; paths are replaced with example values).
$ node hash.js
node:internal/crypto/hash:101
this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:101:19)
at Object.createHash (node:crypto:139:10)
at Object.<anonymous> (/path/to/app/hash.js:2:20)
at Module._compile (node:internal/modules/cjs/loader:1781:14)
at Object..js (node:internal/modules/cjs/loader:1913:10)
at Module.load (node:internal/modules/cjs/loader:1505:32)
at Function._load (node:internal/modules/cjs/loader:1309:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:254:19)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
at node:internal/main/run_main_module:36:49 {
opensslErrorStack: [
'error:03000086:digital envelope routines::initialization error',
'error:0308010C:digital envelope routines::unsupported'
],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v22.23.4
The Error: line does not contain the name ERR_OSSL_EVP_UNSUPPORTED. The error name is on the code: line near the end. digital envelope routines is the name of the OpenSSL part that handles hashes and ciphers together (EVP). "unsupported" means that part rejected the request. The second line of the stack is createHash, so the failure happened when createHash('md4') was called.
Node.js 24.22.1 printed the same Error: error:0308010C:digital envelope routines::unsupported and code: 'ERR_OSSL_EVP_UNSUPPORTED', and exited with code 1. The only differences were the internal line numbers and stack frames, and opensslErrorStack contained only the single initialization error line.
When I caught the error with try/catch, err.code and err.message were as follows (the same on Node.js 22.23.4 and 24.22.1). To tell this error apart from others, compare code.
ERR_OSSL_EVP_UNSUPPORTED
error:0308010C:digital envelope routines::unsupported
The cause: OpenSSL 3 removed md4 from the defaults
Running the same hash.js on Node.js 16.20.2 raised no error and printed 866437cb7a794bce2b727acc0362ee27. Node.js 16.20.2 bundles OpenSSL 1.1.1v, while 22.23.4 and 24.22.1 bundle 3.5.9.
According to the Node.js 17.0.0 release notes, Node.js switched to OpenSSL 3.0 starting with version 17. The same notes say that ERR_OSSL_EVP_UNSUPPORTED on Node.js 17 most likely means that the app or a module is trying to use an algorithm or key length that OpenSSL 3.0 does not allow by default.
md4 is one of those algorithms that are not available by default. The OpenSSL 3.0 migration guide explains that old algorithms such as MD2 and DES were moved to a separate component called the "legacy provider." They still work in 3.0 but are not loaded by default. The same guide says "MD4 has been moved to the Legacy Provider," and the legacy provider page lists MD4 among the hash algorithms.
The list of hashes that Node.js exposes (crypto.getHashes()) shows the difference too.
$ node -p "require('node:crypto').getHashes().includes('md4')"
false
It printed false on Node.js 22.23.4 and 24.22.1, and true on 16.20.2. The Node.js crypto documentation also states that the algorithms createHash accepts depend on what the OpenSSL in that environment supports.
Fix 1: change to sha256 or another supported algorithm in your own code
If you call md4 yourself, the root fix is to switch to an algorithm that OpenSSL 3 supports by default. A hash-sha256.js that changes 'md4' to 'sha256' ran without errors on both Node.js 22.23.4 and 24.22.1.
const crypto = require('node:crypto');
console.log(crypto.createHash('sha256').update('hello').digest('hex'));
$ node hash-sha256.js
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Changing the algorithm changes both the hash value and its length. If you stored md4 values as file names or database keys, the new values will not match the old ones.
Fix 2: upgrade webpack if the error comes from a webpack 4 build
I installed webpack 4.46.0 and built a src/index.js that contained only console.log('hello from webpack');. On Node.js 22.23.4, running the webpack installed in the project as node node_modules/.bin/webpack --mode production stopped with the same error (exit code 1; paths are replaced with example values).
$ node node_modules/.bin/webpack --mode production
node:internal/crypto/hash:101
this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:101:19)
at Object.createHash (node:crypto:139:10)
at module.exports (/path/to/app/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/path/to/app/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/path/to/app/node_modules/webpack/lib/NormalModule.js:471:10)
at /path/to/app/node_modules/webpack/lib/NormalModule.js:503:5
at /path/to/app/node_modules/webpack/lib/NormalModule.js:358:12
at /path/to/app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/path/to/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/path/to/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/path/to/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /path/to/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at /path/to/app/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
opensslErrorStack: [
'error:03000086:digital envelope routines::initialization error',
'error:0308010C:digital envelope routines::unsupported'
],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v22.23.4
The third line of the stack is node_modules/webpack/lib/util/createHash.js. The failure is not in my code. webpack calls md4 to hash modules and fails there. Node.js 24.22.1 gave the same error, while the same project built successfully on 16.20.2.
Upgrade to webpack 4.47.0
To fix this while staying on webpack 4, upgrade to 4.47.0. The webpack 4.47.0 release notes include "Add support for md4 in Node >=18."
npm install -D webpack@4.47.0
After the upgrade, the build succeeded on both Node.js 22.23.4 and 24.22.1. Running the generated dist/main.js printed hello from webpack. The build hash (Hash: 20f4f22df204cc899d1a) matched the value from webpack 4.46.0 on Node.js 16.20.2.
$ node node_modules/.bin/webpack --mode production
Hash: 20f4f22df204cc899d1a
Version: webpack 4.47.0
Time: 45ms
Built at: 11/15/2026 1:06:31 AM
Asset Size Chunks Chunk Names
main.js 963 bytes 0 [emitted] main
Entrypoint main = main.js
[0] ./src/index.js 35 bytes {0} [built]
4.47.0 still uses md4 for hashing. What changed is where the computation happens. In the installed 4.47.0, lib/util/createHash.js branches on the Node.js major version. From version 18 on, it uses ./hash/md4 instead of OpenSSL. That md4.js contains WebAssembly code that computes md4, and it runs through wasm-hash.
Move to webpack 5
With npm install -D webpack@5, the installed 5.112.2 build succeeded on both Node.js 22.23.4 and 24.22.1.
$ node node_modules/.bin/webpack --mode production
asset main.js 34 bytes [emitted] [minimized] (name: main)
./src/index.js 35 bytes [built] [code generated]
webpack 5.112.2 compiled successfully in 207 ms
The webpack 5.61.0 release notes say "use a wasm md4 implementation for node 17 support." In the installed 5.112.2, lib/util/createHash.js also uses ./hash/md4 when "md4" is specified.
Changing the hash function in config does not fix it
I stayed on webpack 4.46.0 and tried changing the hash function to sha256 in the config.
module.exports = {
output: { hashFunction: 'sha256' },
};
With this config, the build no longer stopped at webpack's module hashing. It did fail at the end with ERROR in main.js from Terser, exit code 1. The stack below is excerpted and the paths are replaced with example values. The same error came from createHash inside terser-webpack-plugin, which minifies the code.
ERROR in main.js from Terser
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:101:19)
at Object.createHash (node:crypto:139:10)
at internalCreateHash (/path/to/app/node_modules/terser-webpack-plugin/dist/index.js:36:28)
Changing output.hashFunction did not affect the hashes that terser-webpack-plugin creates. Upgrading webpack itself is the more reliable fix.
Fix 3: if you cannot upgrade right away, add –openssl-legacy-provider
If you cannot change the code or upgrade webpack right away, pass --openssl-legacy-provider to Node.js. This enables the older algorithms, including md4. The Node.js command-line documentation describes it as "Enable OpenSSL 3.0 legacy provider."
$ node --openssl-legacy-provider hash.js
866437cb7a794bce2b727acc0362ee27
On both Node.js 22.23.4 and 24.22.1, this printed the same hash as Node.js 16.20.2. With the flag, getHashes() also included md4 (true).
When you do not run node directly, such as in npm scripts or when webpack starts Node.js for you, pass the option through the NODE_OPTIONS environment variable. The same documentation's NODE_OPTIONS section lists this option among those allowed in that variable. I tried it on the webpack 4.46.0 project and the build succeeded.
$ NODE_OPTIONS=--openssl-legacy-provider npx webpack --mode production
Hash: 20f4f22df204cc899d1a
Version: webpack 4.46.0
Time: 133ms
Built at: 11/15/2026 1:06:27 AM
Asset Size Chunks Chunk Names
main.js 963 bytes 0 [emitted] main
Entrypoint main = main.js
[0] ./src/index.js 35 bytes {0} [built]
This is only a temporary workaround. The Node.js 17.0.0 release notes also call it a "temporary workaround." According to the OpenSSL documentation, the legacy provider loaded by this option contains algorithms that are deprecated or considered insecure. Enabling it makes all of them available, not only md4, so use it only until you have upgraded webpack.
The official documentation says --openssl-legacy-provider was added in v16.17.0, but on Node.js 16.20.2 (OpenSSL 1.1.1v) from nodejs.org, I could not use it. Passing it printed bad option: --openssl-legacy-provider and the process exited with code 9 without starting.





