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

blake2 tree hash usage and alternatives #6611

Open
xnox opened this issue Nov 15, 2024 · 3 comments
Open

blake2 tree hash usage and alternatives #6611

xnox opened this issue Nov 15, 2024 · 3 comments
Labels
type/feature request status undecided

Comments

@xnox
Copy link

xnox commented Nov 15, 2024

Is your feature request related to a problem? Please describe

Currently OpenSSL blake2 implementation lacks tree hash options; and thus these are not available via openssl bindings in python. I am considering to remove support for the tree hash options from python, because they seem to be unused / not popular. However, global code search found

final_hash = hashlib.blake2b(node_depth=1, last_node=True, **BLAKE2B_OPTIONS)
which indeed does use blake2 python tree hash support

Describe the solution you'd like

If the tree hash options were no longer available in standard python, what would aiida-core do, and how painful would it be to switch to something else?
Is cryptographic security required?
Is it performance critical?
Does it need to be in standard python?

Or is the need for any tree-hash that is just available in python and capable of creating hashes for otherwise unhashable objects?

Describe alternatives you've considered

Depending on true needs the following alternatives could be considered:

Additional context

Note this is in part driven by the fact that on some python-fips implementations blake access in python is blocked; and thus likely making aiida-core not working.

@xnox xnox added the type/feature request status undecided label Nov 15, 2024
@unkcpz
Copy link
Member

unkcpz commented Nov 15, 2024

The only issue I foresee was the old hash of nodes will changed if we use new hash algorithm. Which means the caching will not work for all nodes and it requires a database migration.
We can try to keep this in mind and do the change when we ask for DB migration for something else.

@xnox
Copy link
Author

xnox commented Nov 15, 2024

I also have a secondary goal of keeping all of this working, even when python is in FIPS mode. As far as I can tell this usage really is "one-way compression function" rather than a "cryptographic hash". Thus I will experiment to still expose blake2 in python-fips, with "usedforsecurity=False" such that it can continue to be built. Then propose for aiida-core to pass that argument (when running on python3.9 or higher). Such that blake2 usage continues to be available, and aiida continious to work as is, and people can deploy it in FIPS environment (I have no idea if any do, but it seems easy enough to ensure they can).

@xnox
Copy link
Author

xnox commented Nov 19, 2024

Note to self tuplehash seems to be a perfect fit for this use case, but would need to implement that in OpenSSL and then Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature request status undecided
Projects
None yet
Development

No branches or pull requests

2 participants