Hi there, i need to use this function but it is write in Python and if is possible i dont want to start learning Python just for one function so i wanted to ask if someoen can direct me to Pythong to C# convertor or help me convert this function.
from ctypes import c_uint32, c_int32
unid = "|HItem:2,1565456761:-146123031:1273837477,-2012337763,1951515674,-334812892:-1:0:130756:9:8:8:523:523:0:0:6:0:-648496672:|h[Galraki]|h"
def hashString(s):
h = 0
for c in s:
h = c_uint32((h * 0x21) + ord(c)).value
return h
def IDLink(s):
parts = s.split(":")
affixes = parts[3].split(',')
affixes.reverse()
parts[3] = ','.join(affixes)
parts[9] = str(int(parts[9]) | 0x1)
hash_input = ':'.join(parts[1:-2]) + ':'
link_hash = c_int32(hashString(hash_input)).value
parts[-2] = str(link_hash)
id = ':'.join(parts)
return id
print IDLink(unid)
Thanks for all the help in advance!