From c11f334fa433c9fe1e3ddd0c174a6c8a40209d95 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sun, 15 Aug 2021 15:37:34 +0200 Subject: [PATCH] Policy: Use EnumMap for improved performance --- .../src/main/java/org/pgpainless/policy/Policy.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java b/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java index 1c2e8d45..a2fec31f 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java +++ b/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java @@ -17,7 +17,7 @@ package org.pgpainless.policy; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; +import java.util.EnumMap; import java.util.List; import java.util.Map; @@ -390,7 +390,7 @@ public final class Policy { public static final class PublicKeyAlgorithmPolicy { - private final Map algorithmStrengths = new HashMap<>(); + private final Map algorithmStrengths = new EnumMap<>(PublicKeyAlgorithm.class); public PublicKeyAlgorithmPolicy(Map minimalAlgorithmBitStrengths) { this.algorithmStrengths.putAll(minimalAlgorithmBitStrengths); @@ -423,7 +423,7 @@ public final class Policy { * @return default algorithm policy */ public static PublicKeyAlgorithmPolicy defaultPublicKeyAlgorithmPolicy() { - Map minimalBitStrengths = new HashMap<>(); + Map minimalBitStrengths = new EnumMap<>(PublicKeyAlgorithm.class); // ยง5.4.1 minimalBitStrengths.put(PublicKeyAlgorithm.RSA_GENERAL, 2000); minimalBitStrengths.put(PublicKeyAlgorithm.RSA_SIGN, 2000);