nx_mse_keys.nx
buildroot/runtime/nx_mse_keys.nx
about
nx_mse_keys.nx -- MSE/PE key derivation: turn the DH shared secret S + info_hash SKEY into the two RC4
channel keys, per the MSE spec. keyA = SHA1("keyA" | S | SKEY) drives the INITIATOR->receiver stream;
keyB = SHA1("keyB" | S | SKEY) drives receiver->initiator. Each RC4 stream discards its first 1024 bytes.
Also derives the handshake sync hashes: HASH("req1",S), HASH("req2",SKEY), HASH("req3",S). Composes
nx_mse_dh (DH) + nx_rc4 (cipher) + nx_sha1 (HASH). This is the crypto glue between DH and the wire handshake.
nx_mse_keys -- no-arg = GATE: real DH secret -> keyA/keyB -> bidirectional RC4 channels round-trip; VC ok.
license_tier: ORIGINAL module: nishi-core.torrent.mse_keys depends: mse_dh, rc4, sha1
dependencies 3 imports · 2 importers
imports: nx_mse_dh.nxnx_rc4.nxnx_sha1.nx
imported by: nx_mse_handshake.nxnx_mse_wire.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 12 | const K_MAGIC_1024: i64 = 1024 |
functions
| 15 | func mk_derive(prefix: *u8, s_bytes: *u8, skey: *u8, out20: *u8) -> i64 |
| 24 | func mk_hash_pref(prefix: *u8, data: *u8, dlen: i64, out20: *u8) -> i64 |
| 32 | func mk_eq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 } called by 1: main |
| 34 | func main() -> i64 |