Class HashCalculator

java.lang.Object
com.pnfsoftware.jeb.util.encoding.HashCalculator

public class HashCalculator extends Object
Memory and CPU efficient way to compute message digests.

This class supersedes Hash.

  • Field Details

  • Constructor Details

    • HashCalculator

      public HashCalculator(InputStream in, int flags)
  • Method Details

    • crc32

      public static final Long crc32(InputStream in)
      Utility method.
    • adler32

      public static final Long adler32(InputStream in)
      Utility method.
    • md5

      public static final byte[] md5(InputStream in)
      Utility method.
    • sha1

      public static final byte[] sha1(InputStream in)
      Utility method.
    • sha256

      public static final byte[] sha256(InputStream in)
      Utility method.
    • getSize

      public long getSize()
    • getCrc32

      public long getCrc32()
    • getAdler32

      public long getAdler32()
    • getMd5

      public byte[] getMd5()
    • getSha1

      public byte[] getSha1()
    • getSha256

      public byte[] getSha256()
    • compute

      public boolean compute() throws IOException
      Compute the requested digests and stream size.
      Returns:
      true on success, false if one of the requested digest algorithm is not available
      Throws:
      IOException - on stream IO error