1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 22:32:07 +01:00

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

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;