BigInt
Minimal pure-Kotlin unsigned big integer, base 2^32 (limbs are UInt stored in an IntArray little-endian: limb 0 is least significant). Non-negative values only. That is all KiteTorrent's crypto stack needs (MSE Diffie-Hellman modular exponentiation over a fixed 768-bit prime, and the ed25519 field/scalar arithmetic).
There is no BigInteger in the Kotlin common standard library, so libtorrent's reliance on boost::multiprecision (see src/pe_crypto.cpp) has to be reimplemented from scratch. This class provides exactly the primitives required: comparison, add / subtract / multiply, schoolbook long-division remainder (mod), modular multiplication and modular exponentiation (modPow, the analogue of boost::multiprecision::powm), plus fixed-width big-endian byte (de)serialization.
It favours clarity and correctness over speed. The numbers involved are small (<= ~768 bits for DH, <= ~512 bits intermediate for the field), so the O(n^2) multiply and bit-at-a-time division are perfectly adequate.
Works on every KMP target: only IntArray, UInt/ULong limb math and stdlib helpers are used.