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
boolean compute()
Compute the requested digests and stream size.
long getAdler32()
long getCrc32()
byte[] getMd5()
byte[] getSha1()
byte[] getSha256()
long getSize()
[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 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 long getAdler32 ()

public long getCrc32 ()

public byte[] getMd5 ()

public byte[] getSha1 ()

public byte[] getSha256 ()

public long getSize ()