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

Add salt/personalisation strings for Blake2b #105

Merged
merged 4 commits into from Jul 25, 2015
Merged

Conversation

namelessjon
Copy link
Contributor

They are exposed as options on the hash constructor. Strings are
zero-padded out to 16 bytes. If they are not provided then a blank
string is passed into the hash.

Need to add some tests, but I've checked against the sodium vectors at least.

@namelessjon
Copy link
Contributor Author

I realise this needs a version check, because the function doesn't exist in older libsodiums, too

@tarcieri
Copy link
Contributor

@namelessjon in the scrypt code, rather than an explicit version check, I was rescuing FFI::NotFoundError

@tarcieri
Copy link
Contributor

@namelessjon perhaps you could use crypto_generichash_blake2b_salt_personal if available and fall back on crypto_generichash_blake2b for older versions of libsodium?

@namelessjon
Copy link
Contributor Author

It's a little more complex, as that also needs to modify the calls and raise if salt/personal is passed in to a non-supporting implementation

@tarcieri
Copy link
Contributor

Yep, it should only raise NotImplementedError if you pass in an unsupported parameter

@tarcieri
Copy link
Contributor

@namelessjon mind if I release 3.1.0 with scrypt without this? I'd like to start using scrypt support

@tarcieri
Copy link
Contributor

Well, I went ahead and shipped 3.1.0, so... 😉

@namelessjon
Copy link
Contributor Author

I do take slightly longer than 6 minutes to reply, especially while asleep. 👅

That said, was the right call.

@namelessjon
Copy link
Contributor Author

I will land this before you release 4.0.0. We can use that as an excuse to bump up the required library version up to 0.7.0 (as we'll need that for the SecretBuffer anyway). That way, there's no need to define the whole class two ways, to allow for sodium versions without the personal_salt blake variant.

@tarcieri tarcieri added this to the 4.0 milestone Aug 26, 2014
@tarcieri
Copy link
Contributor

Cool, added it to the 4.0 milestone

@namelessjon
Copy link
Contributor Author

This has now been updated for the size_t fix I made in the mainline.

@tarcieri
Copy link
Contributor

Plan on adding some tests?

@namelessjon
Copy link
Contributor Author

Tests? What are those? ;)

More seriously, need to find some test vectors (probably from the sodium tests)

They are exposed as options on the hash constructor.  Strings are
zero-padded out to 16 bytes.  If they are not provided then a blank
string is passed into the hash.
These use test vectors generated from reference C code
@namelessjon
Copy link
Contributor Author

There now with some tests. The vectors I generated myself using the reference implementation of blake2.

@tarcieri
Copy link
Contributor

Nice! Looking good from here

namelessjon added a commit that referenced this pull request Jul 25, 2015
Add salt/personalisation strings for Blake2b
@namelessjon namelessjon merged commit 3faa80f into master Jul 25, 2015
@namelessjon namelessjon deleted the salt-personal branch July 25, 2015 07:34
@namelessjon
Copy link
Contributor Author

Merged!

@tarcieri
Copy link
Contributor

w00p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants