From 62ded09b2033f4f59e5d6d712f04f731da1f31ef Mon Sep 17 00:00:00 2001 From: jc55 Date: Wed, 11 Jun 2025 14:06:56 -0400 Subject: [PATCH 1/2] change hash alg to use sha256 instead of md5 --- packages/vue2-jest/lib/index.js | 2 +- packages/vue3-jest/lib/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vue2-jest/lib/index.js b/packages/vue2-jest/lib/index.js index 3e34b2d9..94928eb5 100644 --- a/packages/vue2-jest/lib/index.js +++ b/packages/vue2-jest/lib/index.js @@ -8,7 +8,7 @@ module.exports = { { config, configString, instrument, rootDir } ) { return crypto - .createHash('md5') + .createHash('sha256') .update( babelJest.createTransformer().getCacheKey(fileData, filename, { config, diff --git a/packages/vue3-jest/lib/index.js b/packages/vue3-jest/lib/index.js index 3e34b2d9..94928eb5 100644 --- a/packages/vue3-jest/lib/index.js +++ b/packages/vue3-jest/lib/index.js @@ -8,7 +8,7 @@ module.exports = { { config, configString, instrument, rootDir } ) { return crypto - .createHash('md5') + .createHash('sha256') .update( babelJest.createTransformer().getCacheKey(fileData, filename, { config, From 9cf81fe813d7f6410bec7b7768d284f122d0f0d5 Mon Sep 17 00:00:00 2001 From: Gregory Snow Date: Tue, 24 Jun 2025 10:31:26 -0400 Subject: [PATCH 2/2] make the use of sha256 alg conditional to avoid performance impact for non-FIPS systems --- packages/vue2-jest/lib/index.js | 7 ++++++- packages/vue3-jest/lib/index.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/vue2-jest/lib/index.js b/packages/vue2-jest/lib/index.js index 94928eb5..0fef2f58 100644 --- a/packages/vue2-jest/lib/index.js +++ b/packages/vue2-jest/lib/index.js @@ -1,5 +1,10 @@ const crypto = require('crypto') const babelJest = require('babel-jest').default + +// get FIPS status and set hash algorithm accordingly +const isFips = crypto.getFips ? crypto.getFips() : false +const hashAlgorithm = isFips ? 'sha256' : 'md5' + module.exports = { process: require('./process'), getCacheKey: function getCacheKey( @@ -8,7 +13,7 @@ module.exports = { { config, configString, instrument, rootDir } ) { return crypto - .createHash('sha256') + .createHash(hashAlgorithm) .update( babelJest.createTransformer().getCacheKey(fileData, filename, { config, diff --git a/packages/vue3-jest/lib/index.js b/packages/vue3-jest/lib/index.js index 94928eb5..0fef2f58 100644 --- a/packages/vue3-jest/lib/index.js +++ b/packages/vue3-jest/lib/index.js @@ -1,5 +1,10 @@ const crypto = require('crypto') const babelJest = require('babel-jest').default + +// get FIPS status and set hash algorithm accordingly +const isFips = crypto.getFips ? crypto.getFips() : false +const hashAlgorithm = isFips ? 'sha256' : 'md5' + module.exports = { process: require('./process'), getCacheKey: function getCacheKey( @@ -8,7 +13,7 @@ module.exports = { { config, configString, instrument, rootDir } ) { return crypto - .createHash('sha256') + .createHash(hashAlgorithm) .update( babelJest.createTransformer().getCacheKey(fileData, filename, { config,