Skip to content
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

Feature/sha256 #9

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Feature/sha256 #9

merged 2 commits into from
Nov 12, 2024

Conversation

leo-mazzone
Copy link
Collaborator

TL;DR

SHA1 is not cryptographically secure, so I'm using SHA256 instead.

Rationale

The cryptographic requirements are not well defined at this stage of the project. However, we know that SHA1 has multiple vulnerabilities that would certainly preclude any cryptographic property we might want from hashes down the line.

SHA256 and SHA512 are both considered safe (at least publicly). While SHA256 has a more or less comparable length to SHA1 (160 vs 256 bits), unlike SHA512, which is more “future-proof”, i.e. if substantial computational advantages were made SHA512 would be more resistant. However, this is overkill at this stage.

In terms of collisions, SHA256 is safe enough. The probability of just two hashes accidentally colliding is approximately: 4.3*10-60 source, which is astronomically small.

There are details about how to use these message digest algorithms, for example the use of a salt, which is appropriate for password storage to avoid rainbow table attacks. They might also be appropriate in this case to reduce the probability of collision if many records are similar. However, this doesn’t increase the length of the hash, thus making it a problem for the production system, not for this benchmarking stage

@leo-mazzone leo-mazzone merged commit 29d88d1 into main Nov 12, 2024
5 checks passed
@leo-mazzone leo-mazzone deleted the feature/sha256 branch November 12, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant