This directory contains a small Python reference implementation for the DNSCrypt v2 protocol.
The code is intended to be read alongside the specification.
It keeps the specification names and favors direct field construction over abstraction.
The implementation is split by topic:
constants.pyanderrors.py: protocol constants and exception typescrypto.py: HChaCha20, DNSCrypt's XChaCha20_DJB-Poly1305, HKDF, X25519, Ed25519certificates.py: certificate parsing, signing, profile extensions, selectionpackets.pyandtransport.py: DNSCrypt packets, TCP framing, Anonymized DNSCryptpq.py: X-Wing, PQ key derivation, tickets, responses, resumed queriesdnscrypt.py: re-exports the public reference API