/* rc4.h — ARC4 stream cipher for MSE/PE (BitTorrent message-stream encryption). * * MSE keys RC4 from a SHA-1 of the negotiated DH secret and *discards the first * 1024 keystream bytes* before use (the well-known RC4 keystream-bias defense), * so naut_rc4_init takes a drop count. This is obfuscation, not strong crypto — * its job is firewall/ISP evasion, and the engineering concern here is that it * costs real CPU at 10 GbE (see the throughput budget), hence it lives behind a * tight, in-place API. */ #ifndef NAUT_RC4_H #define NAUT_RC4_H #include "naut/common.h" typedef struct { uint8_t s[256]; uint8_t i, j; } naut_rc4; void naut_rc4_init(naut_rc4 *c, const void *key, size_t keylen, size_t drop); /* XOR keystream into buf in place (encrypt == decrypt). */ void naut_rc4_xor(naut_rc4 *c, void *buf, size_t len); #endif /* NAUT_RC4_H */