Skip to content

Commit 6e175bc

Browse files
authored
Merge pull request #6549 from webpack/md4_hash
Use MD4 for hashing
2 parents 0e1f9c6 + 40ee8c7 commit 6e175bc

File tree

41 files changed

+125
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+125
-121
lines changed

lib/HashedModuleIdsPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class HashedModuleIdsPlugin {
1414

1515
this.options = Object.assign({
1616
context: null,
17-
hashFunction: "md5",
17+
hashFunction: "md4",
1818
hashDigest: "base64",
1919
hashDigestLength: 4
2020
}, options);

lib/ModuleFilenameHelpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const getBefore = (str, token) => {
4242
};
4343

4444
const getHash = str => {
45-
const hash = createHash("md5");
45+
const hash = createHash("md4");
4646
hash.update(str);
4747
return hash.digest("hex").substr(0, 4);
4848
};

lib/SourceMapDevToolPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class SourceMapDevToolPlugin {
211211
basename: basename(filename)
212212
});
213213
if(sourceMapFile.includes("[contenthash]")) {
214-
sourceMapFile = sourceMapFile.replace(/\[contenthash\]/g, createHash("md5").update(sourceMapString).digest("hex"));
214+
sourceMapFile = sourceMapFile.replace(/\[contenthash\]/g, createHash("md4").update(sourceMapString).digest("hex"));
215215
}
216216
const sourceMapUrl = options.publicPath ? options.publicPath + sourceMapFile.replace(/\\/g, "/") : path.relative(path.dirname(file), sourceMapFile).replace(/\\/g, "/");
217217
if(currentSourceMappingURLComment !== false) {

lib/WebpackOptionsDefaulter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
125125
this.set("output.crossOriginLoading", false);
126126
this.set("output.jsonpScriptType", false);
127127
this.set("output.chunkLoadTimeout", 120000);
128-
this.set("output.hashFunction", "md5");
128+
this.set("output.hashFunction", "md4");
129129
this.set("output.hashDigest", "hex");
130130
this.set("output.hashDigestLength", 20);
131131
this.set("output.devtoolLineToLine", false);

lib/optimize/ConcatenatedModule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class ConcatenatedModule extends Module {
361361
orderedConcatenationListIdentifiers += " ";
362362
}
363363
}
364-
const hash = createHash("md5");
364+
const hash = createHash("md4");
365365
hash.update(orderedConcatenationListIdentifiers);
366366
return this.rootModule.identifier() + " " + hash.digest("hex");
367367
}

lib/optimize/SplitChunksPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const GraphHelpers = require("../GraphHelpers");
1010
const isSubset = require("../util/SetHelpers").isSubset;
1111

1212
const hashFilename = (name) => {
13-
return crypto.createHash("md5").update(name).digest("hex").slice(0, 8);
13+
return crypto.createHash("md4").update(name).digest("hex").slice(0, 8);
1414
};
1515

1616
const sortByIdentifier = (a, b) => {
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
Hash: 1d3bfcee111df03fa6251d3bfcee111df03fa625
1+
Hash: a82dbd8d6c7a22df1cafa82dbd8d6c7a22df1caf
22
Child fitting:
3-
Hash: 1d3bfcee111df03fa625
3+
Hash: a82dbd8d6c7a22df1caf
44
Time: Xms
55
Built at: Thu Jan 01 1970 00:00:00 GMT
66
Asset Size Chunks Chunk Names
7-
706f97eb6a2b8fb1a17e.js 1.05 KiB 0 [emitted]
8-
a65f8652fd07c12d0049.js 9.92 KiB 1 [emitted]
9-
4c485a9e1dc58eedfbd1.js 1.94 KiB 2 [emitted]
10-
337c857e3e34cc5ef72d.js 1.94 KiB 3 [emitted]
11-
Entrypoint main = 4c485a9e1dc58eedfbd1.js 337c857e3e34cc5ef72d.js a65f8652fd07c12d0049.js
12-
chunk {0} 706f97eb6a2b8fb1a17e.js 916 bytes <{1}> <{2}> <{3}>
7+
fb95acf7c457672e70d0.js 1.05 KiB 0 [emitted]
8+
a1e683753eca705a0882.js 9.92 KiB 1 [emitted]
9+
d43339a3d0f86c6b8d90.js 1.94 KiB 2 [emitted]
10+
6c7fb52c5514dbfbf094.js 1.94 KiB 3 [emitted]
11+
Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js a1e683753eca705a0882.js
12+
chunk {0} fb95acf7c457672e70d0.js 916 bytes <{1}> <{2}> <{3}>
1313
> ./g [4] ./index.js 7:0-13
1414
[7] ./g.js 916 bytes {0} [built]
15-
chunk {1} a65f8652fd07c12d0049.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered]
15+
chunk {1} a1e683753eca705a0882.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered]
1616
> ./index main
1717
[3] ./e.js 899 bytes {1} [built]
1818
[4] ./index.js 111 bytes {1} [built]
1919
[6] ./f.js 900 bytes {1} [built]
20-
chunk {2} 4c485a9e1dc58eedfbd1.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted
20+
chunk {2} d43339a3d0f86c6b8d90.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted
2121
> ./index main
2222
[0] ./b.js 899 bytes {2} [built]
2323
[5] ./a.js 899 bytes {2} [built]
24-
chunk {3} 337c857e3e34cc5ef72d.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted
24+
chunk {3} 6c7fb52c5514dbfbf094.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted
2525
> ./index main
2626
[1] ./c.js 899 bytes {3} [built]
2727
[2] ./d.js 899 bytes {3} [built]
2828
Child content-change:
29-
Hash: 1d3bfcee111df03fa625
29+
Hash: a82dbd8d6c7a22df1caf
3030
Time: Xms
3131
Built at: Thu Jan 01 1970 00:00:00 GMT
3232
Asset Size Chunks Chunk Names
33-
706f97eb6a2b8fb1a17e.js 1.05 KiB 0 [emitted]
34-
a65f8652fd07c12d0049.js 9.92 KiB 1 [emitted]
35-
4c485a9e1dc58eedfbd1.js 1.94 KiB 2 [emitted]
36-
337c857e3e34cc5ef72d.js 1.94 KiB 3 [emitted]
37-
Entrypoint main = 4c485a9e1dc58eedfbd1.js 337c857e3e34cc5ef72d.js a65f8652fd07c12d0049.js
38-
chunk {0} 706f97eb6a2b8fb1a17e.js 916 bytes <{1}> <{2}> <{3}>
33+
fb95acf7c457672e70d0.js 1.05 KiB 0 [emitted]
34+
a1e683753eca705a0882.js 9.92 KiB 1 [emitted]
35+
d43339a3d0f86c6b8d90.js 1.94 KiB 2 [emitted]
36+
6c7fb52c5514dbfbf094.js 1.94 KiB 3 [emitted]
37+
Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js a1e683753eca705a0882.js
38+
chunk {0} fb95acf7c457672e70d0.js 916 bytes <{1}> <{2}> <{3}>
3939
> ./g [4] ./index.js 7:0-13
4040
[7] ./g.js 916 bytes {0} [built]
41-
chunk {1} a65f8652fd07c12d0049.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered]
41+
chunk {1} a1e683753eca705a0882.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered]
4242
> ./index main
4343
[3] ./e.js 899 bytes {1} [built]
4444
[4] ./index.js 111 bytes {1} [built]
4545
[6] ./f.js 900 bytes {1} [built]
46-
chunk {2} 4c485a9e1dc58eedfbd1.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted
46+
chunk {2} d43339a3d0f86c6b8d90.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted
4747
> ./index main
4848
[0] ./b.js 899 bytes {2} [built]
4949
[5] ./a.js 899 bytes {2} [built]
50-
chunk {3} 337c857e3e34cc5ef72d.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted
50+
chunk {3} 6c7fb52c5514dbfbf094.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted
5151
> ./index main
5252
[1] ./c.js 899 bytes {3} [built]
5353
[2] ./d.js 899 bytes {3} [built]
Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,65 @@
1-
Hash: af168fd06ab994207f62
1+
Hash: ca712e9bc95207b9082e
22
Time: Xms
33
Built at: Thu Jan 01 1970 00:00:00 GMT
44
Asset Size Chunks Chunk Names
5-
031881c6ced2f576ff79.js 1.94 KiB 5 [emitted]
6-
ba1a8dd27d611254d495.js 1.93 KiB 0 [emitted]
7-
81950df8ced1664c8037.js 1.96 KiB 2 [emitted]
8-
2a7cf3b38962fac54bb9.js 1.94 KiB 3 [emitted]
9-
acfde31fdfbd1bdb41c4.js 1.01 KiB 4 [emitted]
10-
f4818881f9e5138ad8ac.js 1 KiB 1 [emitted]
11-
93666bd6f2b79d06cb66.js 1.94 KiB 6, 7 [emitted]
12-
a28f1d7d7367daaaf00a.js 1 KiB 7 [emitted]
13-
1c507089c2c8ceb9757d.js 1.94 KiB 8 [emitted]
14-
9ac0014114101e5f7d2c.js 1.94 KiB 9, 1 [emitted]
15-
f507739d37522e79688a.js 8.38 KiB 10 [emitted] main
16-
Entrypoint main = f507739d37522e79688a.js
17-
chunk {0} ba1a8dd27d611254d495.js 1.76 KiB <{10}> ={1}= ={2}= ={3}= ={7}= ={9}= [recorded] aggressive splitted
5+
620d3f8d9bdb989cde07.js 1.94 KiB 6, 7 [emitted]
6+
4467a9f70ef8365bcb32.js 1.93 KiB 0 [emitted]
7+
8debdc7e72b763a13e35.js 1.96 KiB 2 [emitted]
8+
6a2c2702ac98f9f90db9.js 1.94 KiB 3, 1 [emitted]
9+
258ba4b441feff644266.js 1.01 KiB 4 [emitted]
10+
8ae4998ca98adb2a08ea.js 1.94 KiB 5 [emitted]
11+
aafb9d82e452def4c3bb.js 1 KiB 1 [emitted]
12+
344e13508b62e833aacf.js 1 KiB 7 [emitted]
13+
2aaed192bbfbc2302c53.js 1.94 KiB 8 [emitted]
14+
72e04d4eaed46d9aac4c.js 1.94 KiB 9 [emitted]
15+
d20b83dfd7d0fd0c8793.js 8.41 KiB 10 [emitted] main
16+
1165c0cca1ba14a506ff.js 1.94 KiB 11 [emitted]
17+
Entrypoint main = d20b83dfd7d0fd0c8793.js
18+
chunk {0} 4467a9f70ef8365bcb32.js 1.76 KiB <{10}> ={1}= ={2}= ={3}= ={7}= ={9}= [recorded] aggressive splitted
1819
> ./b ./d ./e ./f ./g [11] ./index.js 5:0-44
1920
> ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72
2021
[0] ./b.js 899 bytes {0} {5} [built]
2122
[1] ./d.js 899 bytes {0} {8} [built]
22-
chunk {1} f4818881f9e5138ad8ac.js 899 bytes <{10}> ={0}= ={2}= ={8}=
23+
chunk {1} aafb9d82e452def4c3bb.js 899 bytes <{10}> ={0}= ={2}= ={8}=
2324
> ./c ./d ./e [11] ./index.js 3:0-30
2425
> ./b ./d ./e ./f ./g [11] ./index.js 5:0-44
25-
[2] ./e.js 899 bytes {1} {9} [built]
26-
chunk {2} 81950df8ced1664c8037.js 1.76 KiB <{10}> ={0}= ={1}= ={3}= ={6}= ={7}= ={9}= [recorded] aggressive splitted
26+
[2] ./e.js 899 bytes {1} {3} [built]
27+
chunk {2} 8debdc7e72b763a13e35.js 1.76 KiB <{10}> ={0}= ={1}= ={11}= ={3}= ={6}= ={7}= ={9}= [recorded] aggressive splitted
2728
> ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51
2829
> ./b ./d ./e ./f ./g [11] ./index.js 5:0-44
2930
> ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72
3031
[3] ./f.js 899 bytes {2} [built]
3132
[4] ./g.js 901 bytes {2} [built]
32-
chunk {3} 2a7cf3b38962fac54bb9.js 1.76 KiB <{10}> ={0}= ={2}= ={6}= ={7}= ={9}= [recorded] aggressive splitted
33-
> ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51
33+
chunk {3} 6a2c2702ac98f9f90db9.js 1.76 KiB <{10}> ={0}= ={2}= ={7}= ={9}= [rendered] [recorded] aggressive splitted
3434
> ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72
35-
[6] ./h.js 899 bytes {3} [built]
36-
[7] ./i.js 899 bytes {3} [built]
37-
chunk {4} acfde31fdfbd1bdb41c4.js 899 bytes <{10}>
35+
[2] ./e.js 899 bytes {1} {3} [built]
36+
[6] ./h.js 899 bytes {3} {11} [built]
37+
chunk {4} 258ba4b441feff644266.js 899 bytes <{10}>
3838
> ./a [11] ./index.js 1:0-16
3939
[10] ./a.js 899 bytes {4} [built]
40-
chunk {5} 031881c6ced2f576ff79.js 1.76 KiB <{10}>
40+
chunk {5} 8ae4998ca98adb2a08ea.js 1.76 KiB <{10}>
4141
> ./b ./c [11] ./index.js 2:0-23
4242
[0] ./b.js 899 bytes {0} {5} [built]
4343
[5] ./c.js 899 bytes {5} {8} [built]
44-
chunk {6} 93666bd6f2b79d06cb66.js 1.76 KiB <{10}> ={2}= ={3}=
44+
chunk {6} 620d3f8d9bdb989cde07.js 1.76 KiB <{10}> ={11}= ={2}=
4545
> ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51
4646
[8] ./j.js 901 bytes {6} {9} [built]
4747
[9] ./k.js 899 bytes {6} {7} [built]
48-
chunk {7} a28f1d7d7367daaaf00a.js 899 bytes <{10}> ={0}= ={2}= ={3}= ={9}=
48+
chunk {7} 344e13508b62e833aacf.js 899 bytes <{10}> ={0}= ={2}= ={3}= ={9}=
4949
> ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72
5050
[9] ./k.js 899 bytes {6} {7} [built]
51-
chunk {8} 1c507089c2c8ceb9757d.js 1.76 KiB <{10}> ={1}= [recorded] aggressive splitted
51+
chunk {8} 2aaed192bbfbc2302c53.js 1.76 KiB <{10}> ={1}= [recorded] aggressive splitted
5252
> ./c ./d ./e [11] ./index.js 3:0-30
5353
[1] ./d.js 899 bytes {0} {8} [built]
5454
[5] ./c.js 899 bytes {5} {8} [built]
55-
chunk {9} 9ac0014114101e5f7d2c.js 1.76 KiB <{10}> ={0}= ={2}= ={3}= ={7}= [recorded] aggressive splitted
55+
chunk {9} 72e04d4eaed46d9aac4c.js 1.76 KiB <{10}> ={0}= ={2}= ={3}= ={7}= [rendered] [recorded] aggressive splitted
5656
> ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72
57-
[2] ./e.js 899 bytes {1} {9} [built]
57+
[7] ./i.js 899 bytes {9} {11} [built]
5858
[8] ./j.js 901 bytes {6} {9} [built]
59-
chunk {10} f507739d37522e79688a.js (main) 248 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< [entry]
59+
chunk {10} d20b83dfd7d0fd0c8793.js (main) 248 bytes >{0}< >{1}< >{11}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< [entry] [rendered]
6060
> ./index main
61-
[11] ./index.js 248 bytes {10} [built]
61+
[11] ./index.js 248 bytes {10} [built]
62+
chunk {11} 1165c0cca1ba14a506ff.js 1.76 KiB <{10}> ={2}= ={6}= [rendered] [recorded] aggressive splitted
63+
> ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51
64+
[6] ./h.js 899 bytes {3} {11} [built]
65+
[7] ./i.js 899 bytes {9} {11} [built]

test/statsCases/chunks-development/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hash: 5ce1f032cffdff8368b5
1+
Hash: e81afb52ad447e8765ab
22
Time: Xms
33
Built at: Thu Jan 01 1970 00:00:00 GMT
44
Asset Size Chunks Chunk Names

test/statsCases/chunks/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hash: 7870601bc1a1a4f9c4c1
1+
Hash: 4a1bda30edd6ae541ab2
22
Time: Xms
33
Built at: Thu Jan 01 1970 00:00:00 GMT
44
Asset Size Chunks Chunk Names

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy