Class DigestAlgorithm


  • public class DigestAlgorithm
    extends Object
    Maps OCFL defined digest algorithms to their Java names. Java does not include built-in implementations for all of the algorithms, using a 3rd party provider, such as BouncyCastle, is necessary for some, such as blake2b. New algorithms should be registered in the DigestAlgorithmRegistry.
    • Method Detail

      • fromOcflName

        public static DigestAlgorithm fromOcflName​(String ocflName)
        Creates a DigestAlgorithm for the given OCFL name. If the name is not mapped in the DigestAlgorithmRegistry then a new object is created, but not automatically added to the registry. Newly created DigestAlgorithms are not automatically mapped to Java names.
        Parameters:
        ocflName - ocfl name of algorithm
        Returns:
        digest algorithm
      • fromOcflName

        public static DigestAlgorithm fromOcflName​(String ocflName,
                                                   String javaStandardName)
        Creates a DigestAlgorithm for the given OCFL name. If the name is not mapped in the DigestAlgorithmRegistry then a new object is created, but not automatically added to the registry.
        Parameters:
        ocflName - ocfl name of algorithm
        javaStandardName - the name of the algorithm in Java
        Returns:
        digest algorithm
      • getOcflName

        public String getOcflName()
        The OCFL name for the digest algorithm.
        Returns:
        standardized ocfl name for the digest algorithm
      • getJavaStandardName

        public String getJavaStandardName()
        The Java name for the digest algorithm.
        Returns:
        name of the digest algorithm in Java or null
      • hasJavaStandardName

        public boolean hasJavaStandardName()
        Indicates whether or not there is a Java mapping for the algorithm.
        Returns:
        whether or not the digest algorithm has a Java name
      • getMessageDigest

        public MessageDigest getMessageDigest()
        Returns a new MessageDigest
        Returns:
        MessageDigest
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object