Package-level declarations

Types

Link copied to clipboard

Diffie-Hellman key exchange for BitTorrent Message Stream Encryption (MSE/PE). Pure-Kotlin port of dh_key_exchange in libtorrent's src/pe_crypto.cpp.

Link copied to clipboard
object Ed25519

Ed25519 signatures (RFC 8032), pure Kotlin. Used by libtorrent for BEP-44 mutable DHT items; the C++ lives under src/ed25519/ (ref10: ge.cpp, fe.cpp, sc.cpp, sign.cpp, keypair.cpp, verify.cpp).

Link copied to clipboard
class Hasher

Incremental SHA-1 hasher producing a Sha1Hash, the port of libtorrent's hasher (hasher.hpp). It computes v1 info-hashes and piece hashes.

Link copied to clipboard
class Hasher256

Incremental SHA-256 hasher producing a Sha256Hash, the port of libtorrent's hasher256. Used for BitTorrent v2 piece hashing and merkle-tree nodes.

Link copied to clipboard
object MseCrypto

Message Stream Encryption / Protocol Encryption (MSE/PE). This is the pure-crypto half of the obfuscated BitTorrent handshake.

Link copied to clipboard
class MseEncryption(encryptKey: Sha1Hash, decryptKey: Sha1Hash)

Holds the two keyed RC4 streams for one MSE connection, the port of libtorrent's rc4_handler. There is one Rc4 instance per direction. Each is keyed, then its first MseCrypto.RC4_DISCARD (1024) keystream bytes are discarded, exactly as rc4_handler::set_outgoing_key and set_incoming_key do.

Link copied to clipboard
class Rc4(key: ByteArray)

RC4 (ARC4) stream cipher. Pure-Kotlin port of the libTomCrypt-derived rc4_init / rc4_encrypt in libtorrent's src/pe_crypto.cpp, used by the Message Stream Encryption / Protocol Encryption (MSE/PE) handshake.

Link copied to clipboard
class Sha1

Incremental SHA-1 (FIPS 180-1). Pure-Kotlin port of libtorrent's bundled public-domain SHA-1 (src/sha1.cpp). libtorrent uses this when no platform crypto backend (CommonCrypto, CNG, libcrypto, gcrypt) is available, which is also our situation in commonMain.

Link copied to clipboard
class Sha256

Incremental SHA-256 (FIPS 180-4). Pure-Kotlin port of libtorrent's bundled SHA-256 (src/sha256.cpp), used for BitTorrent v2 piece hashing and merkle trees.

Link copied to clipboard
class Sha512

Incremental SHA-512 (FIPS 180-4), pure Kotlin on 64-bit Long arithmetic. libtorrent pulls SHA-512 in for ed25519 (DHT mutable items, BEP 44); KiteTorrent needs it for the same reason. Validated against the FIPS test vectors.