nx_mse_handshake.nx
buildroot/runtime/nx_mse_handshake.nx
about
nx_mse_handshake.nx -- the FULL MSE/PE obfuscated handshake over a real socket (anti-throttle keystone).
Two parties complete the Message Stream Encryption handshake so an ISP's DPI sees only high-entropy bytes
(no "BitTorrent protocol" string, no fixed structure) and can't fingerprint+throttle the connection:
A->B: Ya (DH pubkey; + optional PadA -- 0 here)
B->A: Yb
A->B: HASH(req1,S) | HASH(req2,SKEY)^HASH(req3,S) | RC4_keyA( VC | crypto_provide | lenPadC=0 | lenIA=0 )
B->A: RC4_keyB( VC | crypto_select | lenPadD=0 )
then: the RC4 streams (keyA A->B, keyB B->A) carry the rest -- e.g. the BT handshake -- ENCRYPTED.
Composes nx_mse_keys (DH + keyA/keyB + req-hashes) + nx_rc4 + sockets. GATE = loopback A<->B: negotiate RC4,
verify VC both ways, then A sends an ENCRYPTED payload B decrypts to the exact plaintext. (Pads=0 for the
gate; live interop adds random pads + B's req1-hash stream-sync scan -- noted, not needed to prove the crypto.)
nx_mse_handshake -- no-arg = the loopback GATE
license_tier: ORIGINAL module: nishi-core.torrent.mse_handshake depends: mse_keys (dh+rc4+sha1)
dependencies 2 imports · 0 importers
imports: nx_mse_keys.nxnx_connect.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 18 | const HS_MAGIC_1024: i64 = 1024 |
| 20 | const HS_PORT: i64 = 53811 |
functions
| 22 | func hs_sockaddr(sa: *u8, port: i64, a: i64, b: i64, c: i64, d: i64) -> i64 called by 1: main |
| 27 | func hs_read_n(fd: i64, buf: *u8, n: i64) -> i64 { var g: i64=0; while g<n { let r: i64=sys_read(fd, buf+g, n-g); if r<=0 { return 0-1 } g=g+r } return g } |
| 28 | func hs_write_n(fd: i64, buf: *u8, n: i64) -> i64 { var o: i64=0; while o<n { let w: i64=sys_write(fd, buf+o, n-o); if w<=0 { return 0-1 } o=o+w } return n } called by 1: main |
| 29 | func if_zero(v: i64) -> i64 { if v==0 { return 1 } return 0 } called by 1: main |
| 30 | func hs_put4(b: *u8, o: i64, v: i64) -> i64 { b[o]=((v>>24)&0xff) as u8; b[o+1]=((v>>16)&0xff) as u8; b[o+2]=((v>>8)&0xff) as u8; b[o+3]=(v&0xff) as u8; return o+4 } called by 1: main |
| 31 | func hs_memeq(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 |
| 32 | func hs_xor20(a: *u8, b: *u8, out: *u8) -> i64 { var i: i64=0; while i<20 { out[i]=((a[i] as i64) ^ (b[i] as i64)) as u8; i=i+1 } return 0 } called by 1: main |
| 34 | func hs_rc4_open(S: *u8, ij: *i64, key20: *u8) -> i64 { rc4_ksa(S, key20, 20); ij[0]=0; ij[1]=0; rc4_skip(S, ij, HS_MAGIC_1024); return 0 } |
| 36 | func main() -> i64 |