Roblox CDN, How do I know which one to use?

Hi, I am trying to use the api!/Avatar/get_v1_users_avatar_3d however it returns and then those values returned in the form of text for example.


the OBJ file comes in the format 4844b24bb4b6696ccbafda0c79d2c406 now what CDN does that come from. If you said the same as the origin ( you are wrong it comes form

This subdomain varies from player to player for OBJs and MTL files, so is there a API to tell me what the correct subdomain is? Or am I going mad? Please Help??

– Gerald


If you want to solve this problem without sending a request or looping through all CDNs, this trick works.

Here’s a little JavaScript code snippet that’ll do the job:

function get(hash) {
    for (var i = 31, t = 0; t < 32; t++)
        i ^= hash[t].charCodeAt(0);
    return `https://t${(i % 8).toString()}${hash}`;

and the same thing in Python:

def get(hash):
    i = 31
    for char in hash[:32]:
        i ^= ord(char)  # i ^= int(char, 16) also works
    return f"https://t{i%8}{hash}"

It creates a variable i with a value of 31, iterates through the first 32 characters of the string, and, on each iteration, sets i to itself Bitwise XORed against the integer representation of that character (or, alternatively, just the integer version of the hex value with int(char, 16) if you prefer it - as far as I can tell, it works in the same way)

Thanks to @Julli4n for helping me with the same problem three months ago.


Thanks so much, I wish this was documented somewhere, this saved so much time thanks.

1 Like

Hello, roblox has done it again and updated stuff!!

Updated solution as of 06/12/23 (I am british so I use the better date system)

Happy Coding
– Gerald :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.