Open hamada147 opened 11 months ago
Describe the bug BigInteger.fromByteArray fails in JS but works with no issues in all other platforms.
BigInteger.fromByteArray
To Reproduce Steps to reproduce the behaviour:
val byteArrayInBase64Padded = "P6XiWtDoaj6g3le12ljqjl3J/ZXa/kRswC9GNUYmkTU=" val byteArray = byteArrayInBase64Padded.base64PadDecodedBytes // value is [63, -91, -30, 90, -48, -24, 106, 62, -96, -34, 87, -75, -38, 88, -22, -114, 93, -55, -3, -107, -38, -2, 68, 108, -64, 47, 70, 53, 70, 38, -111, 53] // correct value val bigInteger = BigInteger.fromByteArray(byteArray, Sign.POSITIVE) // fails here with `ClassCastException` println(bigInteger.toString()) // 28788801469504357252816216561604952156895770089726804292579259475621317087541
Expected behaviour Should create a BigInteger value without issue.
Platform [JS]
If JS (please complete the following information):
Additional context The following method in unit test testToAndFromByteArray on https://github.com/ionspin/kotlin-multiplatform-bignum/blob/main/bignum/src/commonTest/kotlin/com/ionspin/kotlin/bignum/integer/ByteArrayConversionTest.kt also fails with the same exception ClassCastException.
testToAndFromByteArray
ClassCastException
Thanks for reporting.
Sorry for taking so long to look into this, is it still reproducible?
Unfortunately yes, it is still reproducible
Describe the bug
BigInteger.fromByteArray
fails in JS but works with no issues in all other platforms.To Reproduce Steps to reproduce the behaviour:
Expected behaviour Should create a BigInteger value without issue.
Platform [JS]
If JS (please complete the following information):
Additional context The following method in unit test
testToAndFromByteArray
on https://github.com/ionspin/kotlin-multiplatform-bignum/blob/main/bignum/src/commonTest/kotlin/com/ionspin/kotlin/bignum/integer/ByteArrayConversionTest.kt also fails with the same exceptionClassCastException
.