Skip to content

Commit 3d9b894

Browse files
authored
fix: move to sha256 (#4038)
1 parent ef39e9b commit 3d9b894

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

lib/command/run-multiple.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function executeRun(runName, runConfig) {
124124
if (browserConfig.outputName) {
125125
outputDir += typeof browserConfig.outputName === 'function' ? browserConfig.outputName() : browserConfig.outputName;
126126
} else {
127-
const hash = crypto.createHash('md5');
127+
const hash = crypto.createHash('sha256');
128128
hash.update(JSON.stringify(browserConfig));
129129
outputDir += hash.digest('hex');
130130
}

lib/plugin/stepByStepReport.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ module.exports = function (config) {
8989
const reportDir = config.output ? path.resolve(global.codecept_dir, config.output) : defaultConfig.output;
9090

9191
event.dispatcher.on(event.test.before, (test) => {
92-
const md5hash = crypto.createHash('md5').update(test.file + test.title).digest('hex');
93-
dir = path.join(reportDir, `record_${md5hash}`);
92+
const sha256hash = crypto.createHash('sha256').update(test.file + test.title).digest('hex');
93+
dir = path.join(reportDir, `record_${sha256hash}`);
9494
mkdirp.sync(dir);
9595
stepNum = 0;
9696
error = null;

test/acceptance/session_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Scenario('screenshots reflect the current page of current session @Puppeteer @Pl
3030
I.saveScreenshot('session_john_2.png');
3131
});
3232

33-
const [default1Digest, default2Digest, john1Digest, john2Digest] = await I.getMD5Digests([
33+
const [default1Digest, default2Digest, john1Digest, john2Digest] = await I.getSHA256Digests([
3434
`${output_dir}/session_default_1.png`,
3535
`${output_dir}/session_default_2.png`,
3636
`${output_dir}/session_john_1.png`,
@@ -88,7 +88,7 @@ Scenario('should save screenshot for active session @WebDriverIO @Puppeteer @Pla
8888

8989
const fileName = clearString(this.title);
9090

91-
const [original, failed] = await I.getMD5Digests([
91+
const [original, failed] = await I.getSHA256Digests([
9292
`${output_dir}/original.png`,
9393
`${output_dir}/${fileName}.failed.png`,
9494
]);

test/support/ScreenshotSessionHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class ScreenshotSessionHelper extends Helper {
1717
this.outputPath = output_dir;
1818
}
1919

20-
getMD5Digests(files = []) {
20+
getSHA256Digests(files = []) {
2121
const digests = [];
2222

2323
for (const file of files) {
24-
const hash = crypto.createHash('md5');
24+
const hash = crypto.createHash('sha256');
2525
const data = fs.readFileSync(file);
2626
hash.update(data);
2727

0 commit comments

Comments
 (0)