public static byte [ ] hash ( InputStream in ) throws IOException { if ( HASH_DIGEST == null ) { throw new EvernoteUtilException ( EDAM_HASH_ALGORITHM + " not supported" , new NoSuchAlgorithmException ( EDAM_HASH_ALGORITHM ) ) ; } byte [ ] buf = new byte [ 1024 ] ; int n ; while ( ( n = in . read ( buf ) ) != - 1 ) { HASH_DIGEST . update ( buf , 0 , n ) ; } return HASH_DIGEST . digest ( ) ; }
Returns an MD5 checksum of the contents of the provided InputStream .