chb0kotlin
06/09/2017, 6:16 PMprivate fun hash(f: File): String {
MessageDigest.getInstance(hashAlgo)?.let {
FileInputStream(f).let { f ->
IOUtils.copy(f, DigestOutputStream(NullOutputStream(), it))
f.close()
}
it.digest().map { String.format("%02x",it) }.reduce{String::plus}
}
throw RuntimeException("Something went wrong")
}
nkiesel
06/10/2017, 12:08 AM