public class Sha1Digest extends Object implements MessageDigest
Constructor and Description |
---|
Sha1Digest() |
Modifier and Type | Method and Description |
---|---|
String |
calculate(File file)
Calculates the message digest for a input stream
|
String |
calculate(InputStream inputStream)
Calculates the message digest for a input stream
|
String |
calculate(String path)
Calculates the message digest for a input stream
|
void |
save(String source)
Saves the message digest for the source file
|
boolean |
verify(String source)
Verify the message digest for a file
|
boolean |
verify(String source,
String digest)
Verify the message digest for a file
|
public static final String HASH_NAME
public String calculate(InputStream inputStream) throws IOException
MessageDigest
calculate
in interface MessageDigest
inputStream
- The input streamIOException
- If unable to read from the input streampublic String calculate(File file) throws IOException
MessageDigest
calculate
in interface MessageDigest
file
- input file to calculate the message streamIOException
- If unable to read the file (ie.: not found)public String calculate(String path) throws IOException
MessageDigest
calculate
in interface MessageDigest
path
- The path to the file to calculate the digestIOException
- If unable to read the file or if unable to read from
the input streampublic boolean verify(String source) throws IOException
MessageDigest
verify
in interface MessageDigest
source
- The (path to the) source fileIOException
- on I/O errorspublic boolean verify(String source, String digest) throws IOException
MessageDigest
verify
in interface MessageDigest
source
- The (path to the) source filedigest
- The message digest to verify againstIOException
- If unable to read the file or if unable to read from
the input streampublic void save(String source) throws IOException
MessageDigest
save
in interface MessageDigest
source
- the (path to the) source fileIOException
- If unable to read the file or if unable to read from
the input streamThis documentation was released into the public domain.