TorrentInfo
A parsed .torrent file. This is the pure-Kotlin counterpart of libtorrent's torrent_info (torrent_info.cpp). Built from the bencoded bytes of a torrent, it exposes the metadata a client needs: the name, the file list, piece geometry, the trackers, and the info-hash or hashes.
The info-hash is SHA-1(info-dict) for v1 (BEP 3) and SHA-256(info-dict) for v2 (BEP 52); a hybrid torrent has both. Because BdecodeNode.dataSection returns the exact bytes the info dictionary was parsed from, the hash is computed over the original bytes and is byte-for-byte identical to every other client's.
v1 (and the v1 side of hybrid torrents) is fully parsed. Pure-v2 file trees are parsed for their file list and per-file merkle roots. This class does not fold the piece layers back to each file's root, so it accepts a .torrent whose piece layers disagree with its file tree.
Properties
The announce tiers (BEP-12), preserved: each inner list is one tier, tried in order. This is the same backing data as trackers; exposed under the libtorrent-aligned name to make the tier structure explicit and to discourage flattening at parse time.
Creation time as a Unix timestamp (seconds), or null.
v1 info-hash (SHA-1 of the info dict), or null for a pure-v2 torrent.
v2 info-hash (SHA-256 of the info dict), or null for a v1-only torrent.
Bencode meta version (2 for v2/hybrid, 1 for classic v1).
The files and piece geometry.
Functions
A flat list of every tracker URL across all tiers (back-compat convenience).
The canonical info-hash hex for display/lookups: the v2 hash when present (it's the stronger identity), otherwise the v1 hash.
For a v2 / hybrid torrent, checks the BEP-52 layout invariant that every file (except the last) begins on a piece boundary. Pad files in a hybrid v1 list, and the v2 file tree's natural per-file trees, are supposed to enforce this. Returns true for v1-only torrents (the invariant does not apply) and for an empty/degenerate layout.
The v1 SHA-1 hash for piece index, sliced from the pieces blob.
The v2 piece hash: the merkle root of piece index's 16 KiB block leaves. This is the verification target for a v2 download. It comes from the piece layers, except for a file that fits in a single piece, where the file's own merkle root is the piece hash.
The 20-byte info-hash used on the wire (the BitTorrent handshake / peer routing): the v1 hash when present, otherwise the v2 SHA-256 truncated to 20 bytes, exactly as libtorrent forms the handshake hash for a v2-only torrent.