MCPcopy Create free account
hub / github.com/core-lib/xjar / hash

Method hash

src/main/java/io/xjar/XKit.java:381–392  ·  view source on GitHub ↗
(File file, MessageDigest hash)

Source from the content-addressed store, hash-verified

379 }
380
381 public static byte[] hash(File file, MessageDigest hash) throws IOException {
382 try (
383 FileInputStream fis = new FileInputStream(file)
384 ) {
385 byte[] buf = new byte[8 * 1024];
386 int len;
387 while ((len = fis.read(buf)) != -1) {
388 hash.update(buf, 0, len);
389 }
390 return hash.digest();
391 }
392 }
393
394}

Callers 2

md5Method · 0.95
sha1Method · 0.95

Calls 1

readMethod · 0.45

Tested by

no test coverage detected