Skip to content

sms-ebarbeito/digest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

digest

Digest - hash calculator from inputStream

Proof of concept. Easy way to calculate hash from a inputStream and feed MessageDigest while consume it.

InputStream is = new DigestInputStream(byteArrayInputStream, digest);

Digest digest = new Digest()
    .withAlgorithm(Algorithm.SHA1)
    .withInputStream(is)
    .initialize();

int ch;
//While consuming the inputStream, it feeds the MessageDigest to calculate the Hash
while( (ch = inputStream.read()) != -1) {
    System.out.print((char)ch);
}

inputStream.close();

//calculate hash
String hash = digest.calculateHash();

About

Digest - hash calculator from inputStream

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages