10000 add support for additional digest types · webpack/webpack@205d3a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 205d3a0

Browse files
committed
add support for additional digest types
1 parent d806cf5 commit 205d3a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/util/hash/wasm-hash.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ class WasmHash {
137137
const { exports, buffered, mem, digestSize } = this;
138138
exports.final(buffered);
139139
this.instancesPool.push(this);
140-
return mem.toString("latin1", 0, digestSize);
140+
const hex = mem.toString("latin1", 0, digestSize);
141+
if (type === "hex") return hex;
142+
if (type === "binary" || !type) return Buffer.from(hex, "hex");
143+
return Buffer.from(hex, "hex").toString(type);
141144
}
142145
}
143146

0 commit comments

Comments
 (0)
0