Skip to content

blake2b/blake2s support - #3116

Merged
alex merged 9 commits into
pyca:masterfrom
reaperhulk:blake2
Aug 29, 2016
Merged

alex merged 9 commits into
pyca:masterfrom
reaperhulk:blake2

Conversation

@reaperhulk

Copy link
Copy Markdown
Member

Doesn't support keying, personalization, salting, or tree hashes so the API is pretty simple right now.

Two outstanding questions:

BLAKE2 supports configurable digest sizes. However, our interface for HashAlgorithm requires the presence of a digest_size, which needs to be provided in the constructor for BLAKE2 (either that or we'll need to generate 96 different classes). At the moment OpenSSL does not currently support anything other than the blake2b 64 byte out put and the blake2s 32 byte output, but it will likely support changing this in the future. I am inclined to say we should remove digest_size from the interface rather than the filthy digest_size = None workaround that's currently in this PR.

Do we want to add personalization, salt, and key to the API now and just error if any of them are passed to the openssl backend? Or do we want to add them later.

I'll add the rest of the tests for coverage once we decide on these issues.

Doesn't support keying, personalization, salting, or tree hashes so
the API is pretty simple right now.
@reaperhulk reaperhulk added this to the Sixteenth Release milestone Aug 27, 2016
@alex

alex commented Aug 27, 2016

Copy link
Copy Markdown
Member
  • The digest_size issue is easily solved by making it a @property on Blake2
  • I don't think there's any point in adding unused parameters ATM.


.. note::

As of OpenSSL 1.1.0 BLAKE2 is only supported as an unkeyed hash with no

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this either needs to be un-keyed or be in the wordlist.

@alex

alex commented Aug 27, 2016

Copy link
Copy Markdown
Member

Turns out un-keyed isn't in the word dictionary either :-(

@reaperhulk

Copy link
Copy Markdown
Member Author

I guess I'll add unkeyed to the dict :)

@reaperhulk reaperhulk mentioned this pull request Aug 27, 2016
2 of 5 tasks
BLAKE2
~~~~~~

`BLAKE2`_ is a cryptographic hash function specified in :rfc:`7693`. It supports

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long.

.. note::

As of OpenSSL 1.1.0 BLAKE2 is only supported as an unkeyed hash with no
personalization or salting features.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's confusing to mention all these features that we don't have, maybe it's better to just omit them for now? Or at least drop them from the opening paragraph and make the note "While the RFC describes for Blake2, currently these are not supported."

This will make BLAKE2 alternate digest size errors a bit less confusing
@reaperhulk reaperhulk changed the title [WIP] blake2b/blake2s support blake2b/blake2s support Aug 28, 2016
@alex

alex commented Aug 28, 2016

Copy link
Copy Markdown
Member

So I think this looks good, one clarifying quesiton: there's exactly one value that will work for digest_size in either of the blake2s, is that right?

@reaperhulk

Copy link
Copy Markdown
Member Author

Correct. For blake2b only 64 works, and for blake2s only 32 works with OpenSSL 1.1.0.

@alex

alex commented Aug 29, 2016

Copy link
Copy Markdown
Member

@reaperhulk how much sense does it really make to expose those options then?

@alex

alex commented Aug 29, 2016

Copy link
Copy Markdown
Member

Can you add a changelog entry?

@reaperhulk

Copy link
Copy Markdown
Member Author

@alex We could hide digest_size as an option, but then when we add it later we'll have to have it default to 64/32. In general we've attempted to avoid default values (outside of None on occasion) so it seemed appropriate to have it here. However, now that I look at the docs it's not at all obvious that you must pass these values for it to work, so at the least I need to add some text saying that.

@alex

alex commented Aug 29, 2016

Copy link
Copy Markdown
Member

It's true we've avoided defaults (and documented our prediliction for doing so!). I can't help feel this is different, but don't have a constructive reason for arguing so though. It's easier to add a default than to remove one though, so this is fine :-)

👍 to clearly documenting this. Will merge after that + changelog.

@alex
alex merged commit 306ce51 into pyca:master Aug 29, 2016
@reaperhulk
reaperhulk deleted the blake2 branch August 29, 2016 01:41
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

2 participants