Skip to content
Permalink
Browse files

#1018 - MD5 plugin replaced by FNV implementation built in Bommerang …

…JS library.
  • Loading branch information
ceckoslab authored and nicjansma committed Oct 2, 2019
1 parent 99ce0b2 commit 9c66ccba62ebf18ad7b8602cf44d0cbad247ce9b
@@ -1642,7 +1642,7 @@ BOOMR_check_doc_domain();
},

/**
* Gets the URL with the query string replaced with a MD5 hash of its contents.
* Gets the URL with the query string replaced with a hash of its contents.
*
* @param {string} url URL
* @param {boolean} stripHash Whether or not to strip the hash
@@ -1669,11 +1669,8 @@ BOOMR_check_doc_domain();
if (stripHash) {
url = url.replace(/#.*/, "");
}
if (!BOOMR.utils.MD5) {
return url;
}
return url.replace(/\?([^#]*)/, function(m0, m1) {
return "?" + (m1.length > 10 ? BOOMR.utils.MD5(m1) : m1);
return "?" + (m1.length > 10 ? BOOMR.utils.hashString(m1) : m1);
});
},

@@ -2322,6 +2319,28 @@ BOOMR_check_doc_domain();
}

return true;
},

/**
* Calculates the FNV hash of the specified string.
*
* @param {string} string Input string
*
* @returns {string} FNV hash of the input string
*
*/
hashString: function(string) {
string = encodeURIComponent(string);
var hval = 0x811c9dc5;

for (var i = 0; i < string.length; i++) {
hval = hval ^ string.charCodeAt(i);
hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
}

var hash = (hval >>> 0).toString() + string.length;

return parseInt(hash).toString(36);
}

/* BEGIN_DEBUG */
@@ -40,7 +40,6 @@ of each plugin:
There are also a few utility plugins:

* `plugins/compression.js` adds {@link BOOMR.utils.Compression} and is used by some plugins for compressing their data
* `plugins/md5.js` adds {@link BOOMR.utils.MD5} support

To monitor basic page load performance for a traditional website, we would recommend:
* {@link BOOMR.plugins.RT}
@@ -5,4 +5,3 @@
* Copyright (c) 2017, Akamai Technologies, Inc. All rights reserved.
* Copyrights licensed under the BSD License. See the accompanying LICENSE.txt file for terms.
*/
/* JavaScript MD5 1.0.1 Copyright 2011, Sebastian Tschan. Licensed under the MIT license. */
@@ -9,7 +9,6 @@
"test": "tests"
},
"dependencies": {
"blueimp-md5": "1.0.1",
"credit-card-regex": "2.0.0",
"error-stack-parser": "1.3.3",
"jsurl": "0.1.3",
@@ -13,7 +13,6 @@
"plugins/mobile.js",
"plugins/memory.js",
"plugins/cache-reload.js",
"plugins/md5.js",
"plugins/compression.js",
"plugins/errors.js",
"plugins/third-party-analytics.js",

This file was deleted.

0 comments on commit 9c66ccb

Please sign in to comment.
You can’t perform that action at this time.