Stabilize HashAlgorithm.fromName()

This commit is contained in:
Paul Schaub 2022-04-16 00:22:41 +02:00
parent 218d7becae
commit b64d6e8e55
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 6 additions and 1 deletions

View File

@ -80,7 +80,12 @@ public enum HashAlgorithm {
*/
@Nullable
public static HashAlgorithm fromName(String name) {
return NAME_MAP.get(name);
String algorithmName = name.toUpperCase();
HashAlgorithm algorithm = NAME_MAP.get(algorithmName);
if (algorithm == null) {
algorithm = NAME_MAP.get(algorithmName.replace("-", ""));
}
return algorithm;
}
private final int algorithmId;