Skip to content

Commit

Permalink
feat(sha-256): switch to sha-256
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Florian Dietrich committed Mar 4, 2016
1 parent 2315157 commit 1b0fc9c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-dactylographsy",
"version": "1.1.0",
"version": "1.2.0",
"main": "src/index.js",
"description": " JavaScript based library to perform fingerprinting on files and generating manifests used by build tools.",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/fingerprinter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Fingerprinter.prototype.hashFiles = function(files) {

files.forEach(function(file) {
var
_hash = crypto.createHash('sha1'),
_hash = crypto.createHash('sha256'),
_digest;

_hash.setEncoding('hex');
Expand All @@ -43,7 +43,7 @@ Fingerprinter.prototype.hashFiles = function(files) {

Fingerprinter.prototype.hashManifest = function(manifest) {
var
_hash = crypto.createHash('sha1'),
_hash = crypto.createHash('sha256'),
_digest;

_hash.setEncoding('hex');
Expand Down
1 change: 0 additions & 1 deletion src/persister.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Persister.prototype.write = function(hashes) {
manifest.rootUrl = this._rootUrl;
manifest.packageUrl = this._packageUrl;
manifest.version = this.fingerprinter.hashManifest(JSON.stringify(manifest));

var manifestAsJson = JSON.stringify(manifest, null, 2);

fs.writeFileSync(this._root + '/' + this._location, manifestAsJson);
Expand Down
3 changes: 1 addition & 2 deletions test/fingerprinter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ manifest = function(file) {
]);

return {
hash: 'a9c51ddc58472676ca510bfbee55e4efc32c8a3f',
hash: '3838ea0c67133131750683037344bedf562296679eeddd92e271994e45e9cede',
hashes: _hashes
};
};
Expand All @@ -25,7 +25,6 @@ describe('Fingerprinter', function() {
it('hashes a set of files', function() {
var
_manifest = manifest('./test/fixtures/persister.json');

expect(_manifest.hashes[_manifest.hash].hash).to.equal(_manifest.hash);
expect(_manifest.hashes[_manifest.hash].extension).to.equal('.json');
expect(_manifest.hashes[_manifest.hash].file).to.equal('persister.json');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
},
"rootUrl": "singularity",
"packageUrl": "timelapse",
"version": "b73e9041d9842aec80ba766c4ca5f16063fbf433"
"version": "dc4ee6d4f1542a63c5e0e9a4c58d220c777ce1f13b705c858c3594899c7c5434"
}
2 changes: 1 addition & 1 deletion test/fixtures/persister.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
},
"rootUrl": "singularity",
"packageUrl": "timelapse",
"version": "b73e9041d9842aec80ba766c4ca5f16063fbf433"
"version": "dc4ee6d4f1542a63c5e0e9a4c58d220c777ce1f13b705c858c3594899c7c5434"
}

0 comments on commit 1b0fc9c

Please sign in to comment.