setHash2

fun setHash2(file: Int, block: Int, h: Sha256Hash): CreateTorrent

Sets the BitTorrent v2 hash for the merkle leaf at block of file file (BEP 52). block is the block index within the file, starting at 0; h is the SHA-256 of that 16 KiB block. An all-zero hash is treated as "unset".

Note: libtorrent's set_hash2 takes the per-piece merkle root, because its disk hasher folds each piece's block tree internally. KiteTorrent's core has no disk hasher, so this method takes the raw block leaves and generate folds each file's merkle tree itself (per-piece roots, file root, and the piece layers).

Throws

if this torrent was constructed v1Only.