https://kotlinlang.org logo
#announcements
Title
# announcements
g

gaetan

10/29/2015, 2:21 PM
Maybe a newbie question but I don’t find the answer in the doc. In the following code:
Copy code
fun String.toSha1():String {
    val toDigest = this
    val digest = with(MessageDigest.getInstance("SHA-1")) {
        update(toDigest.toByteArray("UTF-8")) //todo inline toDigest
        digest()
    }
    return BigInteger(1, digest).toString(16)
}
Is there a way of inlining the toDigest value? Using
this
does not work because of the lambda.