Class MessageDigest

java.lang.Object
org.cdlib.mrt.core.MessageDigest
All Implemented Interfaces:
Serializable, StateStringInf

public class MessageDigest extends Object implements Serializable, StateStringInf
Conainer for a Message Digest including checksum type and checksum value
Author:
dloy
See Also:
  • Field Details

    • value

      protected String value
    • algorithm

      protected MessageDigestType algorithm
    • debugDump

      protected boolean debugDump
  • Constructor Details

    • MessageDigest

      public MessageDigest(String value, MessageDigestType algorithm) throws TException
      Constructor
      Parameters:
      value - checksum value
      algorithm - checksum type
      Throws:
      TException
    • MessageDigest

      public MessageDigest(String value, String algorithmS) throws TException
      Constructor This form of the constructor requires a supported form of the checksum type after normalization. If no supported form is found then a runtime exception is thrown
      Parameters:
      value - checksum value
      algorithmS - String form of checksum type
      Throws:
      TException
  • Method Details

    • setDebugDump

      public void setDebugDump(boolean debugDump)
    • getAlgorithm

      public static MessageDigestType getAlgorithm(String algorithmS)
    • getValue

      public String getValue()
      Return checksum value
      Returns:
      checksum value
    • getAlgorithm

      public MessageDigestType getAlgorithm()
      Return checksum type
      Returns:
      checksum type
    • getJavaAlgorithm

      public String getJavaAlgorithm()
      Return checksum type as used by Java
      Returns:
      Java checksum type
    • equals

      public boolean equals(MessageDigest in)
      Matches one message digest against another
      Parameters:
      in - message digest to be matched against this message digest
      Returns:
      true=match, false=no match
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)