We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c97e88 commit 6fe00e9Copy full SHA for 6fe00e9
1 file changed
sha512/src/main/kotlin/org/komputing/khash/sha512/Sha512.kt
@@ -129,8 +129,10 @@ object Sha512 {
129
private fun padMessage(input: ByteArray): ByteArray {
130
// Need to append at least 17 bytes (16 for length of the message, and 1 for the '1' bit)
131
// then fill with 0s until multiple of 128 bytes
132
- val size = (input.size + 17).let {
133
- if (it % 128 == 0) it else it + 128 - it % 128
+ val size = (input.size + 17).let { padded_input ->
+ (padded_input % 128).let { remainder ->
134
+ if (remainder == 0) padded_input else padded_input + 128 - remainder
135
+ }
136
}
137
138
val len = input.size * 8L
0 commit comments