mirror of https://github.com/status-im/metro.git
Enforce Buffer encoding
Reviewed By: cpojer Differential Revision: D7721212 fbshipit-source-id: 0e42609cca653e4051c6a91801963decd8464a7d
This commit is contained in:
parent
18507aecc9
commit
186376b2d9
|
@ -32,7 +32,7 @@ function stableHash(value: mixed) {
|
||||||
return crypto
|
return crypto
|
||||||
.createHash('md4')
|
.createHash('md4')
|
||||||
.update(JSON.stringify(value, canonicalize))
|
.update(JSON.stringify(value, canonicalize))
|
||||||
.digest();
|
.digest('buffer');
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = stableHash;
|
module.exports = stableHash;
|
||||||
|
|
|
@ -31,7 +31,7 @@ module.exports = function(
|
||||||
const buffer: Buffer = asBuffer(code, encoding);
|
const buffer: Buffer = asBuffer(code, encoding);
|
||||||
const hash = crypto.createHash('sha1');
|
const hash = crypto.createHash('sha1');
|
||||||
hash.update(buffer);
|
hash.update(buffer);
|
||||||
const digest = hash.digest();
|
const digest = hash.digest('buffer');
|
||||||
const signature = Buffer.alloc
|
const signature = Buffer.alloc
|
||||||
? Buffer.alloc(digest.length + 1)
|
? Buffer.alloc(digest.length + 1)
|
||||||
: new Buffer(digest.length + 1);
|
: new Buffer(digest.length + 1);
|
||||||
|
|
Loading…
Reference in New Issue