From cbb880fdecca39b2dffc6b1d32c9c326e3b56b7f Mon Sep 17 00:00:00 2001 From: Keith Shaw Date: Mon, 27 Mar 2017 15:51:14 -0700 Subject: [PATCH] use sha1 instead of Base64 for files names for keys --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6f935c6..7bcef96 100644 --- a/index.js +++ b/index.js @@ -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'); @@ -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')); }); /*