code wiki / _hdl_build / nx_pow_challenge.nx
nx_pow_challenge.nx
buildroot/runtime/_hdl_build/nx_pow_challenge.nx
about
nx_pow_challenge.nx -- proof-of-work client puzzle for the access wall's L7 DDoS shedding (hashcash;
Cloudflare "under attack"). Under high load/anomaly the server issues a fresh CHALLENGE + a difficulty D;
the client must find a SOLUTION such that sha256(challenge || solution) has >= D leading zero bits. The
server VERIFIES in O(1) (one sha256) but the client pays O(2^D) expected work -- the asymmetry that makes a
flood expensive for the attacker and a one-time cost for a legit client. Reuses the KAT-verified nx_sha256
(no rolled crypto). license_tier: ORIGINAL
dependencies 2 imports · 1 importers
imports: nx_sha256.nxnx_syscalls.nx
imported by: nx_pow_challenge_gate.nx
structs
| none |
consts
| none |
functions
| 11 | func pow_lzb(h: *u8) -> i64 |
| 38 | func pow_u2s(v: i64, out: *u8) -> i64 |
| 50 | func pow_verify(challenge: *u8, clen: i64, solution: *u8, slen: i64, difficulty: i64) -> i64 |
| 65 | func pow_solve(challenge: *u8, clen: i64, difficulty: i64, sol_out: *u8, max_tries: i64) -> i64 |