Enforce Buffer encoding

Reviewed By: cpojer

Differential Revision: D7721212

fbshipit-source-id: 0e42609cca653e4051c6a91801963decd8464a7d
This commit is contained in:
Miguel Jimenez Esun 2018-04-21 10:10:35 -07:00 committed by Facebook Github Bot
parent 18507aecc9
commit 186376b2d9
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ function stableHash(value: mixed) {
return crypto
.createHash('md4')
.update(JSON.stringify(value, canonicalize))
.digest();
.digest('buffer');
}
module.exports = stableHash;

View File

@ -31,7 +31,7 @@ module.exports = function(
const buffer: Buffer = asBuffer(code, encoding);
const hash = crypto.createHash('sha1');
hash.update(buffer);
const digest = hash.digest();
const digest = hash.digest('buffer');
const signature = Buffer.alloc
? Buffer.alloc(digest.length + 1)
: new Buffer(digest.length + 1);