I'm getting different results when I run the follo...
# intellij
j
I'm getting different results when I run the following code:
Copy code
val digest = MessageDigest.getInstance("SHA-256")
    digest.update("foo".toByteArray())
    val result1 = digest.digest()
    digest.reset()
    val result2 = digest.digest("foo".toByteArray())
    val areEqual = MessageDigest.isEqual(result1, result2)
    println(areEqual)
The call to
digest.update()
is ignored when run inside of a scratchpad (as opposed to compiled code). So scratchpad prints
false
while running the same block inside of a
main()
prints
true
. Any ideas what could be causing this?
a
This is a bug, created https://youtrack.jetbrains.com/issue/KT-38919. See workaround there.
👍 1