Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3 from keyphact/cheesynoob-patch-1
Browse files Browse the repository at this point in the history
Update utilities.py
  • Loading branch information
cheesynoob authored Aug 6, 2016
2 parents 5bdd8af + 1dbf5a1 commit d3d84df
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion pgoapi/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import time
import struct
import logging
import xxhash

from json import JSONEncoder
from binascii import unhexlify
Expand Down Expand Up @@ -155,4 +156,24 @@ def long_to_bytes (val, endianness='big'):
# see http://stackoverflow.com/a/931095/309233
s = s[::-1]

return s
return s


def generateLocation1(authticket, lat, lng, alt): #u10
firstHash = xxhash.xxh32(bytearray(authticket), seed=0x1B845238).intdigest() #Hashing the auth ticket using static seed 0x1B845238
locationBytes = bytearray([lat,lng,alt]) #Lat, long and alt as a double
locationHash = xxhash.xxh32(locationBytes, seed=firstHash).intdigest() #hash of location using the hashed auth ticket as seed
return locationHash

def generateLocation2(lat, lng, alt): #u20
locationBytes = bytearray([lat,lng,alt])
locationHash = xxhash.xxh32(locationBytes, seed=0x1B845238).intdigest() #Hash of location using static seed 0x1B845238
return locationHash

def generateRequests(requests): #u24
firstHash = xxhash.xxh64(bytearray(authticket), seed=0x1B845238).intdigest() #Hashing the auth ticket using static seed 0x1B845238
hashList = [] #Leaving as a list for now
for req in requests:
hashArray.add(xxhash.xxh64(bytearray(req), seed=firstHash).intdigest() #Hash each request with the hashed auth ticket as seed
hashArray = array(I, hashList) #Convert the list to an array
return hashArray

0 comments on commit d3d84df

Please sign in to comment.