komputing / KBigNumbers

Kotlin multiplatform porting of Java BigInteger and BigDecimal
MIT License
8 stars 1 forks source link

BigInteger initialisation #3

Open createS0ftware opened 5 years ago

createS0ftware commented 5 years ago

Hi

What is the correct way to initialise BigInteger ?

I keep getting a NPE

Thanks

RiccardoM commented 5 years ago

Could you please provide a snapshot of the code you are using? Also the platform you are developing for would be very useful

ligi commented 5 years ago

this seems related and has some details https://github.com/komputing/KHash/issues/11

createS0ftware commented 5 years ago

Yes, it is related. I thought the problem was in that library but it's in this one.

In the Keccak class

private val BIT_65 = BigInteger.ONE.shiftLeft(64)

private val MAX_64_BITS = BIT_65.subtract(BigInteger.ONE)

BigInteger is not initialised prior to this call. I can't seem to find an appropriate way to initialise it

RiccardoM commented 5 years ago

@createS0ftware Are you using which module? The common one or the JVM one?

createS0ftware commented 5 years ago

JVM one

RiccardoM commented 5 years ago

I'm trying to reproduce the error but I don't seem able to do so. Could you please provide us with a full stack trace of the error?

createS0ftware commented 5 years ago

Ok - i will. However, i think i have found a possible fix. I am not importing the library correctly - the architecture of my kotlin multiplatform project, i think is wrong.

Also i am targeting Android, IOS and JVM . I'll update yo tomorrow

Thanks