-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider removing the xxhash dependency #4547
Comments
I think xxhash is used in NuDB as a faster and cheaper hash algorithm than sha256. |
@MarkusTeufelberger I was considering cases where we using a sha-256 hash as a key in an hash table. So we're using
I don't think that |
@seelabs do you think this is a Good First Issue? |
This would leave us vulnerable to algorithmic complexity attacks. The point of xxhash is that it is unpredictable to an attacker. An attacker can predict the SHA256 hashes of transactions, accounts, and ledger objects they create permitting them to force numerous XRPL algorithms into their worst-case behaviors. However, if the input is a SHA256 hash, then a simpler algorithm than xxhash could, in theory, be used because all you need is a defense against algorithmic complexity attacks and not any of the other properties xxhash gives us. For example, you could determine a "seed" at start time that chooses which bytes of the SHA256 hash are extracted and used as a key. Then it's just byte extraction. |
I did not understand the purpose of hashing something that was already a SHA256 hash. Thanks for clarifying. I'm going to close this issue. |
Summary
We currently use xxhash to hash values that are themselves already a sha-256 hash. The code should be audited to see if we could use the sha-256 hash directly and remove the xxhash dependency.
Motivation
It removes a dependency.
Solution
Use a sha-256 hash directly instead of rehashing with xxhash.
The text was updated successfully, but these errors were encountered: