dns.name.encode_0x20

dns.name

encode_0x20(name) -> randomized

Randomize the case of ASCII letters in a domain name (0x20 encoding)

Implements the 0x20 bit-toggling technique for DNS query name encoding. Each ASCII letter is randomly uppercased or lowercased, adding ~1 bit of entropy per letter. Non-letter characters (digits, hyphens, dots) are unchanged. Used by dns.client to detect spoofed responses — a legitimate resolver echoes the question name verbatim, preserving the random casing.