diff --git a/src/index.js b/src/index.js index d2209ed..b2ac4fb 100644 --- a/src/index.js +++ b/src/index.js @@ -26,14 +26,14 @@ var generatePackage = function(websiteJSON, iconsDir, certData, pKeyData, interm // website.json var websiteContent = new Buffer(JSON.stringify(websiteJSON)); - manifest['website.json'] = utils.sha1(websiteContent); + manifest['website.json'] = utils.sha512(websiteContent); zip.file('website.json', websiteContent); // icon.iconset var icons = zip.folder('icon.iconset'), addIconFile = function(name, content) { content = typeof content === 'string' ? fs.readFileSync(content) : content; - manifest['icon.iconset/' + name] = utils.sha1(content); + manifest['icon.iconset/' + name] = utils.sha512(content); icons.file(name, content); }; if (typeof iconsDir === 'object') { diff --git a/src/utils.js b/src/utils.js index b6ed80b..45bbbe5 100644 --- a/src/utils.js +++ b/src/utils.js @@ -9,9 +9,12 @@ module.exports = { } return number + ""; // always return a string }, - sha1: function (content) { - var shasum = crypto.createHash('sha1'); + sha512: function (content) { + var shasum = crypto.createHash('sha512'); shasum.update(content); - return shasum.digest('hex'); + return { + "hashType": "sha512", + "hashValue": shasum.digest('hex') + }; } }; diff --git a/test/utils.test.js b/test/utils.test.js index 58e3885..3a1ba33 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -22,8 +22,8 @@ describe('test zeroFill', function() { }); }); -describe('test sha1', function() { +describe('test sha512', function() { test('it works', function() { - expect(pushUtils.sha1('itworks')).toBe('fe077c8079ace921b8f9bd00d7e50e049acfda94'); + expect(pushUtils.sha512('itworks')).toEqual({"hashType": "sha512", "hashValue": "ff3470c61d4e3f66e69bf472fd48ff67b42be150625aa0d825f0fa86dd7cb6c01e54f0c810b9208371ae3295cf892ae051e93455a041dcdafcf2cffb5d2a245a"}); }); }); \ No newline at end of file