| java.lang.Object java.io.InputStream java.io.FilterInputStream com.Ostermiller.util.MD5InputStream
MD5InputStream | public class MD5InputStream extends FilterInputStream (Code) | | Implements MD5 functionality on a stream.
More information about this class is available from ostermiller.org.
This class produces a 128-bit "fingerprint" or "message digest" for
all data read from this stream.
It is conjectured that it is computationally infeasible to produce
two messages having the same message digest, or to produce any
message having a given pre-specified target message digest. The MD5
algorithm is intended for digital signature applications, where a
large file must be "compressed" in a secure manner before being
encrypted with a private (secret) key under a public-key cryptosystem
such as RSA.
For more information see RFC1321.
See Also: MD5 See Also: MD5OutputStream author: Santeri Paavolainen http://www.helsinki.fi/~sjpaavol/programs/md5/ author: Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities since: ostermillerutils 1.00.00 |
Method Summary | |
public byte[] | getHash() Returns array of bytes representing hash of the stream so far. | public String | getHashString() Get a 32-character hex representation representing hash of the stream so far. | public int | read() Reads the next byte of data from this input stream. | public int | read(byte[] bytes, int offset, int length) Reads up to length bytes of data from this input stream into an
array of bytes. |
MD5InputStream | public MD5InputStream(InputStream in)(Code) | | Creates a MD5InputStream
Parameters: in - the underlying input stream |
getHash | public byte[] getHash()(Code) | | Returns array of bytes representing hash of the stream so far.
Array of 16 bytes, the hash of all read bytes. since: ostermillerutils 1.00.00 |
getHashString | public String getHashString()(Code) | | Get a 32-character hex representation representing hash of the stream so far.
A string containing the hash of all written bytes. since: ostermillerutils 1.00.00 |
read | public int read() throws IOException(Code) | | Reads the next byte of data from this input stream. The value byte
is returned as an int in the range 0 to 255. If no byte is available
because the end of the stream has been reached, the value -1 is returned.
This method blocks until input data is available, the end of the stream is
detected, or an exception is thrown.
This method simply performs in.read() and returns the result.
the next byte of data, or -1 if the end of the stream is reached. throws: IOException - if an I/O error occurs. since: ostermillerutils 1.00.00 |
read | public int read(byte[] bytes, int offset, int length) throws IOException(Code) | | Reads up to length bytes of data from this input stream into an
array of bytes. This method blocks until some input is available.
Parameters: bytes - the buffer into which the data is read. Parameters: offset - the start offset of the data. Parameters: length - the maximum number of bytes read. throws: IOException - if an I/O error occurs. since: ostermillerutils 1.00.00 |
|
|