public class

HashCalculator

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

Class Overview

Memory and CPU efficient way to compute message digests.

This class supersedes Hash.

Summary

Constants
int ADLER32
int CRC32
int MD5
int SHA1
int SHA256
Public Constructors
HashCalculator(InputStream in, int flags)
Public Methods
final static Long adler32(InputStream in)
Utility method.
boolean compute()
Compute the requested digests and stream size.
final static Long crc32(InputStream in)
Utility method.
long getAdler32()
long getCrc32()
byte[] getMd5()
byte[] getSha1()
byte[] getSha256()
long getSize()
final static byte[] md5(InputStream in)
Utility method.
final static byte[] sha1(InputStream in)
Utility method.
final static byte[] sha256(InputStream in)
Utility method.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ADLER32

Constant Value: 2 (0x00000002)

public static final int CRC32

Constant Value: 1 (0x00000001)

public static final int MD5

Constant Value: 4 (0x00000004)

public static final int SHA1

Constant Value: 8 (0x00000008)

public static final int SHA256

Constant Value: 16 (0x00000010)

Public Constructors

public HashCalculator (InputStream in, int flags)

Public Methods

public static final Long adler32 (InputStream in)

Utility method.

public boolean compute ()

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

public static final Long crc32 (InputStream in)

Utility method.

public long getAdler32 ()

public long getCrc32 ()

public byte[] getMd5 ()

public byte[] getSha1 ()

public byte[] getSha256 ()

public long getSize ()

public static final byte[] md5 (InputStream in)

Utility method.

public static final byte[] sha1 (InputStream in)

Utility method.

public static final byte[] sha256 (InputStream in)

Utility method.