
name.remal.java.security.MessageDigest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Java & Kotlin tools: common
The newest version!
package name.remal
import java.io.InputStream
import java.security.MessageDigest
fun MessageDigest.update(data: InputStream) {
val buffer = ByteArray(1024)
while (true) {
val read = data.read(buffer, 0, buffer.size)
if (read < 0) break
update(buffer, 0, read)
}
}
fun MessageDigest.digestHex(data: ByteArray) = encodeHex(digest(data))
fun MessageDigest.digestHex() = encodeHex(digest())
© 2015 - 2025 Weber Informatics LLC | Privacy Policy