Class ThreadSHA256

java.lang.Object
java.lang.ThreadLocal<MessageDigest>
cl.obcom.desktopfx.util.ThreadSHA256

public final class ThreadSHA256 extends ThreadLocal<MessageDigest>
Provides a SHA-256 MessageDigest local to the current running Thread.
  • Method Details

    • initialValue

      protected MessageDigest initialValue()
      Returns the current thread's "initial value" for this thread-local variable. This method will be invoked the first time a thread accesses the variable with the ThreadLocal.get() method, unless the thread previously invoked the ThreadLocal.set(T) method, in which case the initialValue method will not be invoked for the thread. Normally, this method is invoked at most once per thread, but it may be invoked again in case of subsequent invocations of ThreadLocal.remove() followed by ThreadLocal.get().
      Overrides:
      initialValue in class ThreadLocal<MessageDigest>
      Returns:
      the initial value for this thread-local.
      Throws:
      InternalError - if an error occurs creating the initial value-
    • getInstance

      public static MessageDigest getInstance()
      Returns a SHA-256 MessageDigest instance local to current Thread.
      Returns:
      a SHA-256 MessageDigest instance local to current Thread.