Package org.apache.sshd.common.digest
Enum BuiltinDigests
- java.lang.Object
-
- java.lang.Enum<BuiltinDigests>
-
- org.apache.sshd.common.digest.BuiltinDigests
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<BuiltinDigests>
,java.util.function.Supplier<Digest>
,AlgorithmNameProvider
,DigestFactory
,DigestInformation
,Factory<Digest>
,NamedFactory<Digest>
,NamedResource
,OptionalFeature
public enum BuiltinDigests extends java.lang.Enum<BuiltinDigests> implements DigestFactory
Provides easy access to the currently implemented digests
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BuiltinDigests.Constants
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
algorithm
private int
blockSize
private java.lang.String
factoryName
private boolean
supported
static java.util.Set<BuiltinDigests>
VALUES
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
Fields inherited from interface org.apache.sshd.common.OptionalFeature
FALSE, TRUE
-
-
Constructor Summary
Constructors Modifier Constructor Description private
BuiltinDigests(java.lang.String factoryName, java.lang.String algorithm, int blockSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Digest
create()
static BuiltinDigests
fromAlgorithm(java.lang.String algo)
static BuiltinDigests
fromDigest(Digest d)
static BuiltinDigests
fromFactory(NamedFactory<? extends Digest> factory)
static BuiltinDigests
fromFactoryName(java.lang.String name)
static BuiltinDigests
fromString(java.lang.String s)
java.lang.String
getAlgorithm()
int
getBlockSize()
java.lang.String
getName()
boolean
isSupported()
java.lang.String
toString()
static BuiltinDigests
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static BuiltinDigests[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
md5
public static final BuiltinDigests md5
-
sha1
public static final BuiltinDigests sha1
-
sha224
public static final BuiltinDigests sha224
-
sha256
public static final BuiltinDigests sha256
-
sha384
public static final BuiltinDigests sha384
-
sha512
public static final BuiltinDigests sha512
-
-
Field Detail
-
VALUES
public static final java.util.Set<BuiltinDigests> VALUES
-
algorithm
private final java.lang.String algorithm
-
blockSize
private final int blockSize
-
factoryName
private final java.lang.String factoryName
-
supported
private final boolean supported
-
-
Method Detail
-
values
public static BuiltinDigests[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BuiltinDigests c : BuiltinDigests.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BuiltinDigests valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getName
public final java.lang.String getName()
- Specified by:
getName
in interfaceNamedResource
- Returns:
- The resource name
-
getAlgorithm
public final java.lang.String getAlgorithm()
- Specified by:
getAlgorithm
in interfaceAlgorithmNameProvider
-
getBlockSize
public final int getBlockSize()
- Specified by:
getBlockSize
in interfaceDigestInformation
- Returns:
- The number of bytes in the digest's output
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<BuiltinDigests>
-
create
public final Digest create()
-
isSupported
public final boolean isSupported()
- Specified by:
isSupported
in interfaceOptionalFeature
-
fromString
public static BuiltinDigests fromString(java.lang.String s)
- Parameters:
s
- TheEnum
's name - ignored ifnull
/empty- Returns:
- The matching
BuiltinDigests
whoseEnum.name()
matches (case insensitive) the provided argument -null
if no match
-
fromFactory
public static BuiltinDigests fromFactory(NamedFactory<? extends Digest> factory)
- Parameters:
factory
- TheNamedFactory
for the cipher - ignored ifnull
- Returns:
- The matching
BuiltinDigests
whose factory name matches (case insensitive) the digest factory name - See Also:
fromFactoryName(String)
-
fromFactoryName
public static BuiltinDigests fromFactoryName(java.lang.String name)
- Parameters:
name
- The factory name - ignored ifnull
/empty- Returns:
- The matching
BuiltinDigests
whose factory name matches (case insensitive) the provided name -null
if no match
-
fromDigest
public static BuiltinDigests fromDigest(Digest d)
- Parameters:
d
- TheDigest
instance - ignored ifnull
- Returns:
- The matching
BuiltinDigests
whose algorithm matches (case insensitive) the digets's algorithm -null
if no match
-
fromAlgorithm
public static BuiltinDigests fromAlgorithm(java.lang.String algo)
- Parameters:
algo
- The algorithm to find - ignored ifnull
/empty- Returns:
- The matching
BuiltinDigests
whose algorithm matches (case insensitive) the provided name -null
if no match
-
-