GithubHelp home page GithubHelp logo

Incorrect hashes about gta-v-data-dumps HOT 10 CLOSED

durtyfree avatar durtyfree commented on May 24, 2024
Incorrect hashes

from gta-v-data-dumps.

Comments (10)

Wildbrick142 avatar Wildbrick142 commented on May 24, 2024 3

The hash issue is because, for some reason, the signed hashes are calculated with case-sensitivity when they shouldn't be. Take the Sugoi for example:
Name = Sugoi (the S should be lowercase)
Hash = 987469656 (unsigned, this is correct)
(current) SignedHash = -545256593 (case sensitive, incorrect)
(actual) SignedHash = 987469656 (not case-sensitive, how it should be)

I believe the issue stems from the fact that Rockstar sometimes capitalizes the model names in vehicles.meta. I think those really should be all lowercase while being formatted.

from gta-v-data-dumps.

DurtyFree avatar DurtyFree commented on May 24, 2024

Fixed with latest commit, thx

Hashes were not wrong, but signed instead of unsigned variant

from gta-v-data-dumps.

Tianshee avatar Tianshee commented on May 24, 2024

I know what you mean about signed and unsigned variants.
-1934452204 is a valid hash for RapidGT and 2360515092 is a valid hash for RapidGT.
If can call CreateVechicle(-1934452204,... or CreateVechicle(2360515092,... I get RapidGT in both cases.
Two valid hashes for the same vehicle are possible because positive numbers greater than 0x7FFFFFFF turn into negative and vice versa. Hash for RapidGT is 0x8CB29A14 and can be interpreted as positive or negative number.

I can create many more "valid hashes" by adding math.random(1,0xFFFFFFFF)*0x100000000 to any valid hash. All that garbage will be cut before sending the number to the game. For example 71079991828(0x108CB29A14) is still a RapidGT.

It has absolutely nothing to do with hashes in VehicleList.ini!
They are just wrong. Look at this line, for example.
GetHashKey( RHINO )= 782665360 ~= 976373367
Are you saying that those two numbers are basically the same?
782665360 != 976373367
0x2EA68690 != 0x3A324677
I can call IsModelValid(782665360) or CreateVechicle(782665360,...
But I have no idea what 976373367(0x3A324677) is, it's just a seemingly random number.
Another example:
GetHashKey( bobcatXL )= 1069929536 ~= 1719944928
Both numbers are positive and completely different. 1069929536 works, 1719944928 is invalid and it's not possible to turn invalid into valid.

from gta-v-data-dumps.

DurtyFree avatar DurtyFree commented on May 24, 2024

@Tianshee I have no idea what kind of stuff you are trying to explain overly complicated - did you check my commit? 1523cad

from gta-v-data-dumps.

DurtyFree avatar DurtyFree commented on May 24, 2024

I guess what you are trying to say is that SignedHash in my source file (vehicles.json) is sometimes correct and sometimes not?
https://github.com/DurtyFree/gta-v-data-dumps/blob/master/vehicles.json

from gta-v-data-dumps.

Tianshee avatar Tianshee commented on May 24, 2024

Yes, your SignedHash function contains a bug

from gta-v-data-dumps.

Tianshee avatar Tianshee commented on May 24, 2024

Isn't it obvious that SignedHash for BARRACKS is just completely wrong?

    "Name": "BARRACKS",
    "DisplayName": "Barracks",
    "Hash": 3471458123,
    "SignedHash": 720993689,
    "HexHash": "0xCEEA3F4B",

It should be -823509173

from gta-v-data-dumps.

Tianshee avatar Tianshee commented on May 24, 2024

If you want to fix your SignedHash, you can simply replace it with something like this.

int64_t SignedHash(char* txt)
{
    uint64_t h=Hash(txt);
    if(h&0x80000000){ h|=(-1^0x7FFFFFFF); }
    return (int64_t)h;
}

Much better than using two different hash functions supposed to be doing the same thing, isn't it?

from gta-v-data-dumps.

DurtyFree avatar DurtyFree commented on May 24, 2024

Reopened until I have looked into it. Btw I am not using one hash function for each type of hash, which I have way too much in my data dumps - obviously, isn't it?

from gta-v-data-dumps.

DurtyFree avatar DurtyFree commented on May 24, 2024

Fixed with latest commit, huge thx again to @Wildbrick142 for the detailed hint

from gta-v-data-dumps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.