MCPcopy Create free account
hub / github.com/M66B/FairEmail / getHash

Method getHash

app/src/main/java/eu/faircode/email/Helper.java:3279–3288  ·  view source on GitHub ↗
(InputStream is, String algorithm)

Source from the content-addressed store, hash-verified

3277 }
3278
3279 static String getHash(InputStream is, String algorithm) throws NoSuchAlgorithmException, IOException {
3280 MessageDigest digest = MessageDigest.getInstance(algorithm);
3281
3282 int count;
3283 byte[] buffer = new byte[BUFFER_SIZE];
3284 while ((count = is.read(buffer)) != -1)
3285 digest.update(buffer, 0, count);
3286
3287 return hex(digest.digest());
3288 }
3289
3290 static String hex(byte[] bytes) {
3291 StringBuilder sb = new StringBuilder();

Callers 1

getHashMethod · 0.95

Calls 5

hexMethod · 0.95
digestMethod · 0.65
getInstanceMethod · 0.45
readMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected