mirror of
https://github.com/Inori/GPCS4.git
synced 2024-05-20 13:07:58 -04:00
add nid calculator
This commit is contained in:
parent
64a28f58aa
commit
fe63ba0bbb
16
Tools/NidFromFuncName.py
Normal file
16
Tools/NidFromFuncName.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
import sys, os
|
||||
import struct
|
||||
import hashlib
|
||||
import re
|
||||
|
||||
NID_SUFFIX = bytes.fromhex('518D64A635DED8C1E6B039B1C3E55230')
|
||||
|
||||
|
||||
def sha1(data):
|
||||
return hashlib.sha1(data).digest()
|
||||
|
||||
def calculate_nid(symbol):
|
||||
buff = symbol.encode() + NID_SUFFIX
|
||||
return struct.unpack('<Q', sha1(buff)[:8])[0]
|
||||
|
||||
print(calculate_nid(sys.argv[1]))
|
Loading…
Reference in a new issue