All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.atkawa7.encryption.utils.PBKDF2Algorithm Maven / Gradle / Ivy

The newest version!
package io.github.atkawa7.encryption.utils;

public enum PBKDF2Algorithm {
    HMAC_SHA1(0, "PBKDF2WithHmacSHA1"),
    HMAC_SHA256(1, "PBKDF2WithHmacSHA256"),
    HMAC_SHA512(2, "PBKDF2WithHmacSHA512");

    private final int value;
    private final String algorithm;

    PBKDF2Algorithm(int value, String algorithm) {
        this.value = value;
        this.algorithm = algorithm;
    }

    public static PBKDF2Algorithm fromValue(int value) {
        switch (value) {
            case 0:
                return PBKDF2Algorithm.HMAC_SHA1;
            case 1:
                return PBKDF2Algorithm.HMAC_SHA256;
            case 2:
                return PBKDF2Algorithm.HMAC_SHA512;
        }
        throw new IllegalArgumentException("Algorithm with value " + value + " not supported");
    }

    public int getValue() {
        return value;
    }

    public String getAlgorithm() {
        return algorithm;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy