-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
I don't know if it was the same problem as in #1 but the bug is in the actual code.
this line
it.write(encryptedBytes.size)
assumes that encrypted data are smaller than 256 which is quite limiting. Outputstream in fact cannot write bigger int then 1 byte, 8 bits. Kotlin Int, however, has 4 bytes, 32 bits.
Analogically, the decryption has the same bug.
I fixed the code with following lines:
for (i in 0..24 step 8) {
it.write(encryptedBytes.size shr i)
}
and
val encryptedBytesSize = List(4) { it * 8 }.fold(0) { acc, i -> acc + (it.read() and 0xff shl i) }
Metadata
Metadata
Assignees
Labels
No labels