Enum Class BuiltinDigests

java.lang.Object
java.lang.Enum<BuiltinDigests>
org.apache.sshd.common.digest.BuiltinDigests
All Implemented Interfaces:
Serializable, Comparable<BuiltinDigests>, Constable, Supplier<Digest>, AlgorithmNameProvider, DigestFactory, DigestInformation, Factory<Digest>, NamedFactory<Digest>, NamedResource, OptionalFeature

public enum BuiltinDigests extends Enum<BuiltinDigests> implements DigestFactory
Provides easy access to the currently implemented digests
  • Enum Constant Details

  • Field Details

    • VALUES

      public static final Set<BuiltinDigests> VALUES
    • algorithm

      private final String algorithm
    • blockSize

      private final int blockSize
    • factoryName

      private final String factoryName
    • supported

      private final boolean supported
  • Constructor Details

    • BuiltinDigests

      private BuiltinDigests(String factoryName, String algorithm, int blockSize)
  • Method Details

    • values

      public static BuiltinDigests[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BuiltinDigests valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getName

      public final String getName()
      Specified by:
      getName in interface NamedResource
      Returns:
      The resource name
    • getAlgorithm

      public final String getAlgorithm()
      Specified by:
      getAlgorithm in interface AlgorithmNameProvider
    • getBlockSize

      public final int getBlockSize()
      Specified by:
      getBlockSize in interface DigestInformation
      Returns:
      The number of bytes in the digest's output
    • toString

      public final String toString()
      Overrides:
      toString in class Enum<BuiltinDigests>
    • create

      public final Digest create()
      Specified by:
      create in interface Factory<Digest>
      Returns:
      A new instance
    • isSupported

      public final boolean isSupported()
      Specified by:
      isSupported in interface OptionalFeature
    • fromString

      public static BuiltinDigests fromString(String s)
      Parameters:
      s - The Enum's name - ignored if null/empty
      Returns:
      The matching BuiltinDigests whose Enum.name() matches (case insensitive) the provided argument - null if no match
    • fromFactory

      public static BuiltinDigests fromFactory(NamedFactory<? extends Digest> factory)
      Parameters:
      factory - The NamedFactory for the cipher - ignored if null
      Returns:
      The matching BuiltinDigests whose factory name matches (case insensitive) the digest factory name
      See Also:
    • fromFactoryName

      public static BuiltinDigests fromFactoryName(String name)
      Parameters:
      name - The factory name - ignored if null/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 - The Digest instance - ignored if null
      Returns:
      The matching BuiltinDigests whose algorithm matches (case insensitive) the digets's algorithm - null if no match
    • fromAlgorithm

      public static BuiltinDigests fromAlgorithm(String algo)
      Parameters:
      algo - The algorithm to find - ignored if null/empty
      Returns:
      The matching BuiltinDigests whose algorithm matches (case insensitive) the provided name - null if no match