Skip to content

Instantly share code, notes, and snippets.

@axonxorz
Created March 15, 2022 00:46
Show Gist options
  • Save axonxorz/c215d175d7506d95515ca41406fc7314 to your computer and use it in GitHub Desktop.
Save axonxorz/c215d175d7506d95515ca41406fc7314 to your computer and use it in GitHub Desktop.
def do_hash(session_id, track_number):
a = 1234554321
b = 305419896
c = 7
d = track_number + session_id[8:]
for e in range(len(d)):
f = ord(d[e:e+1]) & 255
a = a ^ ((a & 63) + c) * f + (a << 8)
b = b + (b << 8 ^ a)
c = c + f
a &= -2147483649
b &= -2147483649
return '{}{}'.format(hex(a)[-8:],
hex(b)[-8:])
session_id = "u4sk3uab741dd1cc"
tn = "1" # "track1"
print(do_hash(session_id, tn))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment