Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Grover-c13/PokeGOAPI-Java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: Development
Choose a base ref
...
head repository: lordamot/PokeGOAPI-Java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: Development
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 11, 2016

  1. fix: use safe hash instance

    lordamot committed Aug 11, 2016
    Copy the full SHA
    4e5a69a View commit details
Showing with 3 additions and 3 deletions.
  1. +3 −3 library/src/main/java/com/pokegoapi/util/Signature.java
6 changes: 3 additions & 3 deletions library/src/main/java/com/pokegoapi/util/Signature.java
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ private static byte[] getBytes(double input) {

private static int getLocationHash1(PokemonGo api, byte[] authTicket,
RequestEnvelopeOuterClass.RequestEnvelope.Builder builder) {
XXHashFactory factory = XXHashFactory.fastestInstance();
XXHashFactory factory = XXHashFactory.safeInstance();
StreamingXXHash32 xx32 = factory.newStreamingHash32(0x1B845238);
xx32.update(authTicket, 0, authTicket.length);
byte[] bytes = new byte[8 * 3];
@@ -94,7 +94,7 @@ private static int getLocationHash1(PokemonGo api, byte[] authTicket,
}

private static int getLocationHash2(PokemonGo api, RequestEnvelopeOuterClass.RequestEnvelope.Builder builder) {
XXHashFactory factory = XXHashFactory.fastestInstance();
XXHashFactory factory = XXHashFactory.safeInstance();
byte[] bytes = new byte[8 * 3];

System.arraycopy(getBytes(api.getLatitude()), 0, bytes, 0, 8);
@@ -108,7 +108,7 @@ private static int getLocationHash2(PokemonGo api, RequestEnvelopeOuterClass.Req
}

private static long getRequestHash(byte[] authTicket, byte[] request) {
XXHashFactory factory = XXHashFactory.fastestInstance();
XXHashFactory factory = XXHashFactory.safeInstance();
StreamingXXHash64 xx64 = factory.newStreamingHash64(0x1B845238);
xx64.update(authTicket, 0, authTicket.length);
xx64 = factory.newStreamingHash64(xx64.getValue());