Skip to content

Commit

Permalink
use sha1 instead of Base64 for files names for keys
Browse files Browse the repository at this point in the history
  • Loading branch information
keithws committed Mar 27, 2017
1 parent 20a1e77 commit cbb880f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var os = require('os');
var debug = require('debug')('async-disk-cache');
var zlib = require('zlib');
var heimdall = require('heimdalljs');
var crypto = require('crypto');

var CacheEntry = require('./lib/cache-entry');
var Metric = require('./lib/metric');
Expand Down Expand Up @@ -246,7 +247,7 @@ defineFunction(Cache.prototype, 'remove', function(key) {
* @returns the path where the key's value may reside
*/
defineFunction(Cache.prototype, 'pathFor', function(key) {
return path.join(this.root, new Buffer(key).toString('base64'));
return path.join(this.root, crypto.createHash('sha1').update(key).digest('hex'));
});

/*
Expand Down

0 comments on commit cbb880f

Please sign in to comment.