Skip to content

Instantly share code, notes, and snippets.

@InvoxiPlayGames
Created November 9, 2024 12:12
Show Gist options
  • Save InvoxiPlayGames/cb562ccf883723ade1d2f8f59a42ede2 to your computer and use it in GitHub Desktop.
Save InvoxiPlayGames/cb562ccf883723ade1d2f8f59a42ede2 to your computer and use it in GitHub Desktop.
akamai_weirdtoken_generate.py - generates some sort of Akamai token used by some games here and there
# generates some sort of Akamai token used by some games here and there
# in the format of ?token=1735689600_ffeeddccbbaa998877665544332211
# idk what scheme it's called or anything i just know it does what i want it to
# code by Emma 2024 public domain do whatever
import sys
import struct
import hashlib
def create_url_token(path: str, salt: str, expiry: int):
salt_bytes = bytes(salt, encoding='ascii')
path_bytes = bytes(path, encoding='ascii')
# create and hash the first buffer
first_buf = expiry.to_bytes(4, 'little') + path_bytes + salt_bytes
first_hash = hashlib.md5(first_buf)
# create and hash the final buffer
final_buf = salt_bytes + first_hash.digest()
final_hash = hashlib.md5(final_buf)
return str(expiry) + "_" + final_hash.hexdigest()
# example usage:
# create_url_token("/path/to/config.xml", "00112233445566778899aabbccddee", 1735689600)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment