CDN Hashes

Some endpoints, like the  provided by , don't provide a full CDN URL and only provide raw hashes, like this:. We need to turn this into a full CDN URL. A CDN URL looks like  where   is the CDN number. The CDN number ranges from 0 to 7, so you might be tempted to send a request to, then  , and keep going until you reach the one containing the object. This works, but it's quite wasteful as you send up to 8 requests for just one object. There's a better way to do this. We can define a variable as 31, loop through the first 32 characters in the string, and in each iteration set the variable to itself bitwise XORed against the integer representation of that character (or, alternatively, the integer version of the hex value) Python example: JavaScript example: