Package io.ocfl.api.model
Class DigestAlgorithm
- java.lang.Object
-
- io.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 DigestAlgorithm
blake2b160
static DigestAlgorithm
blake2b256
static DigestAlgorithm
blake2b384
static DigestAlgorithm
blake2b512
static DigestAlgorithm
md5
static DigestAlgorithm
sha1
static DigestAlgorithm
sha256
static DigestAlgorithm
sha512
static DigestAlgorithm
sha512_256
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static DigestAlgorithm
fromOcflName(String ocflName)
Creates a DigestAlgorithm for the given OCFL name.static DigestAlgorithm
fromOcflName(String ocflName, String javaStandardName)
Creates a DigestAlgorithm for the given OCFL name.String
getJavaStandardName()
The Java name for the digest algorithm.MessageDigest
getMessageDigest()
Returns a new MessageDigestString
getOcflName()
The OCFL name for the digest algorithm.int
hashCode()
boolean
hasJavaStandardName()
Indicates whether or not there is a Java mapping for the algorithm.String
toString()
-
-
-
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 theDigestAlgorithmRegistry
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 theDigestAlgorithmRegistry
then 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
-
-