Skip to content

Instantly share code, notes, and snippets.

@Zer0xFF
Last active June 16, 2023 19:59
Show Gist options
  • Save Zer0xFF/d94818f15e3e85b0b4d48000a4be1c73 to your computer and use it in GitHub Desktop.
Save Zer0xFF/d94818f15e3e85b0b4d48000a4be1c73 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import binascii
import hashlib
import hmac
import sys
def GetHash(GameID):
byte_key = binascii.unhexlify('AD62E37F905E06BC19593142281C112CEC0E7EC3E97EFDCAEFCDBAAFA6378D84')
hash = hmac.new(byte_key, 'np_%s' % GameID, digestmod=hashlib.sha256)
return hash.hexdigest()
def main(argc, argv) :
if argc < 2:
print('Usage : %s GameID [...]' % argv[0])
return 1
GameIDs = iter(argv)
next(GameIDs)
for GameID in GameIDs:
if len(GameID) != 9:
print('Invalid GameID: %s' % GameID)
continue
hash = GetHash(GameID)
print('GameID: %s' % GameID)
print(' Hash: %s' % hash)
print(' Update XML: https://gs-sec.ww.np.dl.playstation.net/plo/np/%s/%s/%s-ver.xml' % (GameID, hash, GameID))
print('')
if __name__=='__main__':
sys.exit(main(len(sys.argv), sys.argv))
@SocraticBliss
Copy link

SocraticBliss commented Jul 8, 2018

https://pastebin.com/Y2mN1tRx I went ahead and cleaned it up a bit and standardized it to work with python 2 and 3 :)

@Zer0xFF
Copy link
Author

Zer0xFF commented Jul 24, 2018

thanks update the script. (I've kept the binascii import as I prefer it this ya)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment