# Class ConcurrentMessageDigest

java.lang.Object
org.apache.tomcat.util.security.ConcurrentMessageDigest

public class ConcurrentMessageDigest extends Object
A thread safe wrapper around `MessageDigest` that does not make use of ThreadLocal and - broadly - only creates enough MessageDigest objects to satisfy the concurrency requirements.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static byte[]`
  `digest(String algorithm, byte[]... input)`
  `static byte[]`
  `digest(String algorithm, int iterations, byte[]... input)`
  `static byte[]`
  `digestMD5(byte[]... input)`
  `static byte[]`
  `digestSHA1(byte[]... input)`
  `static byte[]`
  `digestSHA256(byte[]... input)`
  `static void`
  `init(String algorithm)`
  Ensures that `digest(String, byte[][])` will support the specified algorithm.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### digestMD5

    public static byte[] digestMD5(byte[]... input)

  - ### digestSHA1

    public static byte[] digestSHA1(byte[]... input)

  - ### digestSHA256

    public static byte[] digestSHA256(byte[]... input)

  - ### digest

    public static byte[] digest(String algorithm, byte[]... input)

  - ### digest

    public static byte[] digest(String algorithm, int iterations, byte[]... input)

  - ### init

    public static void init(String algorithm) throws NoSuchAlgorithmException
    Ensures that `digest(String, byte[][])` will support the specified algorithm. This method must be called and return successfully before using `digest(String, byte[][])`.
    Parameters:
      `algorithm` - The message digest algorithm to be supported
    Throws:
      `NoSuchAlgorithmException` - If the algorithm is not supported by the JVM