Skip to content

Commit 26257bc

Browse files
committed
Feature: Non-crypto hashing algorithm opt-in through config: use non-native hash example
1 parent 307566a commit 26257bc

21 files changed

+21
-8
lines changed

lib/util/createHash.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ class BulkUpdateDecorator {
3333
if(this.buffer.length > 0) {
3434
this.hash.update(this.buffer);
3535
}
36-
return this.hash.digest(encoding);
36+
var digestResult = this.hash.digest(encoding);
37+
if(typeof digestResult !== "string")
38+
return digestResult.toString();
39+
return digestResult;
3740
}
3841
}
3942

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"less": "^2.5.1",
5050
"less-loader": "^4.0.3",
5151
"lodash": "^4.17.4",
52-
"metrohash": "^2.3.0",
5352
"mocha": "^3.2.0",
5453
"mocha-lcov-reporter": "^1.0.0",
5554
"nsp": "^2.6.1",
@@ -67,7 +66,8 @@
6766
"vm-browserify": "~0.0.0",
6867
"webpack-cli": "^1.5.2",
6968
"webpack-dev-middleware": "^1.9.0",
70-
"worker-loader": "^0.8.0"
69+
"worker-loader": "^0.8.0",
70+
"xxhashjs": "^0.2.1"
7171
},
7272
"engines": {
7373
"node": ">=6.11.5"

test/configCases/custom-hash-function/metrohash/webpack.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = [{
2+
output: {
3+
hashFunction: require("xxhashjs").h32
4+
}
5+
}];

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,10 @@ csso@~2.3.1:
16041604
clap "^1.0.9"
16051605
source-map "^0.5.3"
16061606

1607+
cuint@latest:
1608+
version "0.2.2"
1609+
resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b"
1610+
16071611
cvss@^1.0.0:
16081612
version "1.0.2"
16091613
resolved "https://registry.yarnpkg.com/cvss/-/cvss-1.0.2.tgz#df67e92bf12a796f49e928799c8db3ba74b9fcd6"
@@ -5951,6 +5955,12 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1:
59515955
version "4.0.1"
59525956
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
59535957

5958+
xxhashjs@^0.2.1:
5959+
version "0.2.1"
5960+
resolved "https://registry.yarnpkg.com/xxhashjs/-/xxhashjs-0.2.1.tgz#9bbe9be896142976dfa34c061b2d068c43d30de0"
5961+
dependencies:
5962+
cuint latest
5963+
59545964
y18n@^3.2.1:
59555965
version "3.2.1"
59565966
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"

0 commit comments

Comments
 (0)