code: private static byte[] digest(final InputStream input, final String algorithm)
  		throws IOException {
  		try {
  			MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
  			final int bufferLength = 8 * 1024;
  			byte[] buffer = new byte[bufferLength];
  			int read = input.read(buffer, 0, bufferLength);
  
  			while (read > -1) {
  				messageDigest.update(buffer, 0, read);
  				read = input.read(buffer, 0, bufferLength);
  			}
  
  			return messageDigest.digest();
  		} catch (NoSuchAlgorithmException e) {
  			throw new ImpossibleException(e);
  		}
  	}
docs: 对输入流进行散列。
  
  @param input
  输入流
  @param algorithm
  算法名
  @return 散列码
  @throws IOException
  从输入流读取数据失败