From RFC 5389 Section 15.2:
If the IP address family is IPv4, X-Address is computed by taking the mapped IP address in host byte order, XOR'ing it with the magic cookie, and converting the result to network byte order. If the IP address family is IPv6, X-Address is computed by taking the mapped IP address in host byte order, XOR'ing it with the concatenation of the magic cookie and the 96-bit transaction ID, and converting the result to network byte order.
I'm writing a STUN server in Node.JS and I'm trying to understand how one would go about XOR-ing a 128-bit value. I feel as though it would involve using one of these functions from the Buffer
module, though it says it only supports up to 48 bits. Any advice on how to implement a 128-bit XOR operator for an IPv6 address?
Here's my XOR operator from my CryptoPals code: