summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index 22141ff8ae..d1c9eb5d2e 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -608,8 +608,13 @@ function filterDuplicates(names) {
// for example, 'sha1' instead of 'SHA1'.
var ctx = {};
names.forEach(function(name) {
- if (/^[0-9A-Z\-]+$/.test(name)) name = name.toLowerCase();
- ctx[name] = true;
+ var key = name;
+ if (/^[0-9A-Z\-]+$/.test(key)) key = key.toLowerCase();
+ if (!ctx.hasOwnProperty(key) || ctx[key] < name)
+ ctx[key] = name;
});
- return Object.getOwnPropertyNames(ctx).sort();
+
+ return Object.getOwnPropertyNames(ctx).map(function(key) {
+ return ctx[key];
+ }).sort();
}