Ludii Forum
Hashcodes not matching in Remote Play - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Ludii Player Problems (https://ludii.games/forums/forumdisplay.php?fid=6)
+--- Thread: Hashcodes not matching in Remote Play (/showthread.php?tid=277)

Pages: 1 2


Hashcodes not matching in Remote Play - JayCoskey - 11-23-2020

When I and another player try to play the game Glinski Chess against each other using Remote Play, the second player that attempts to join gets the Status message
    The hash codes of the games do not match, suspected game description modification.

This error occurs despite the fact that both players are using Ludii 1.1.1, and both see the same value for  “Game Hash” in the Extra Information control that appears when clicking on “Details” in the Remote control pane. We can successfully use Remote Play for many other games.

Details: Game Id 192, Game Hash: 2087504618. I’m using Mac OS (10.15.7) and the other player is using Windows (64-bit, 10.0, Build 18363).


Thanks,
Jay


RE: Hashcodes not matching in Remote Play - MatthewStephenson - 11-23-2020

Hi Jay,

Thanks for reporting this. 
We think that the problem may be caused by different Java versions producing different hashcodes. 
We are investigating and will let you know what we find.

Cheers,
Matthew


RE: Hashcodes not matching in Remote Play - MatthewStephenson - 11-23-2020

Hi Jay,

Good news! We think we have successfully fixed this problem.
The issue seems to be caused by different Java versions, probably between Java 8 and Java11+, calculating the hash code differently.
We will push out a new version of Ludii later today which should fix this.

Cheers,
Matthew


RE: Hashcodes not matching in Remote Play - JayCoskey - 11-24-2020

Hi Matthew,

Tried again, with Ludii v1.1.2. Got the same message: "The hashcodes of the games do not match, suspected game description modification.". (See game #204, with hash 975768053.) Both players with 64-bit server VMs: one with Java 14.0.2, and the other with 10.0.1.

Cheers,
Jay


RE: Hashcodes not matching in Remote Play - MatthewStephenson - 11-24-2020

Hi Jay,

Thanks for letting us know, I'll look into this ASAP and let you know when its fixed.

Cheers,
Matthew


RE: Hashcodes not matching in Remote Play - MatthewStephenson - 11-24-2020

Hi Jay,

We have tried with several different versions of Java, and they all give the correct hashcode (975768053 is correct).
Could you please try creating a game from the other players computer, so we can see what hashcode they generate.
Also please make sure that both players are using Ludii version 1.1.2

Cheers,
Matthew


RE: Hashcodes not matching in Remote Play - JayCoskey - 11-27-2020

Done. When the same game is started by the other player (running java 10.0.1, see game #230), the resulting hash is -1645192661. (Both players are running Ludii v1.1.2. When a player tries to connect to a game launched from a different version, a different error message results.)

Note that 975768053=0x3a2909f5, while -1645192661=-0x620fa5d5. I don't see any obvious connection between the different bit patterns.

I had the other player (w/ java 10.0.1) start 5 other games. I was able to connect to 4 of them, but not to "Chess". When I tried to connect to Chess, I got the same hashcode-related error message. (java 10.0.1 hash value for Chess is 907057243, while my value from java 14.0.2 was -2111011739.)

Cheers,
Jay


RE: Hashcodes not matching in Remote Play - MatthewStephenson - 11-27-2020

Hi Jay,

Thank you very much for the extra game information! I can see the discrepancy on our Server.
We have tried using Java 8, 10, 11 and 15, and can confirm the "correct" hashcode should be -2111011739

To be honest we aren't really sure why on this specific setup or games the other user is getting a different hashcode....
For the time being, we will try using the full game description rather than its hash for validity checking.
This will help us determine if the cause of the problem is the calculation of the hash value, or if the game description is somehow being interpreted differently on each PC.

We will hopefully push out a new version with this change later today.
We appreciate your continued assistance with addressing this problem.

Cheers,
Matthew


RE: Hashcodes not matching in Remote Play - JayCoskey - 11-27-2020

Hi Matthew,

Thanks for the quick response. Is the file is somehow "expanded" before the hash is computed? Could it have to do with line endings, or perhaps file endings?

Cheers,
Jay


RE: Hashcodes not matching in Remote Play - MatthewStephenson - 11-27-2020

Hi Jay,

A quick update. We think that the cause of the problem is different default text encodings on the PCs.
It seems to be that most computers have UTF-8 as the default encoding but others do not, leading to some characters being interpreted differently.
By changing out default encoding to cp1252, we were able to get the "incorrect" hashcode of the other user.

We are working on a fix now, and will push out a new version of Ludii later today.

Cheers,
Matthew