Package edu.wisc.library.ocfl.api.model
Class DigestAlgorithm
- java.lang.Object
-
- edu.wisc.library.ocfl.api.model.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 theDigestAlgorithmRegistry.
-
-
Field Summary
Fields Modifier and Type Field Description static DigestAlgorithmblake2b160static DigestAlgorithmblake2b256static DigestAlgorithmblake2b384static DigestAlgorithmblake2b512static DigestAlgorithmmd5static DigestAlgorithmsha1static DigestAlgorithmsha256static DigestAlgorithmsha512static DigestAlgorithmsha512_256
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static DigestAlgorithmfromOcflName(String ocflName)Creates a DigestAlgorithm for the given OCFL name.static DigestAlgorithmfromOcflName(String ocflName, String javaStandardName)Creates a DigestAlgorithm for the given OCFL name.StringgetJavaStandardName()The Java name for the digest algorithm.MessageDigestgetMessageDigest()Returns a new MessageDigestStringgetOcflName()The OCFL name for the digest algorithm.inthashCode()booleanhasJavaStandardName()Indicates whether or not there is a Java mapping for the algorithm.StringtoString()
-
-
-
Field Detail
-
md5
public static final DigestAlgorithm md5
-
sha1
public static final DigestAlgorithm sha1
-
sha256
public static final DigestAlgorithm sha256
-
sha512
public static final DigestAlgorithm sha512
-
blake2b512
public static final DigestAlgorithm blake2b512
-
blake2b160
public static final DigestAlgorithm blake2b160
-
blake2b256
public static final DigestAlgorithm blake2b256
-
blake2b384
public static final DigestAlgorithm blake2b384
-
sha512_256
public static final DigestAlgorithm sha512_256
-
-
Method Detail
-
fromOcflName
public static DigestAlgorithm fromOcflName(String ocflName)
Creates a DigestAlgorithm for the given OCFL name. If the name is not mapped in theDigestAlgorithmRegistrythen 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 theDigestAlgorithmRegistrythen a new object is created, but not automatically added to the registry.- Parameters:
ocflName- ocfl name of algorithmjavaStandardName- 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
-
-