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 Blake2X hash functions #689

Merged
merged 4 commits into from Jan 16, 2018

Conversation

Projects
None yet
2 participants
@tiehuis
Member

tiehuis commented Jan 15, 2018

The truncated output variants currently are dependent on a more complete bigint implementation in the compiler.

No speed measurements just yet.

Also, I'm tempted to change the way we return values. Instead of an integer just reverting to a more standard byte array. Not really a huge benefit using integers except for marginally easier comparisons/printing.

Add Blake2X hash functions
The truncated output variants currently are dependent on a more complete
bigint implementation in the compiler.
@andrewrk

This comment has been minimized.

Member

andrewrk commented Jan 15, 2018

I'll work on big int rem today

@andrewrk

This comment has been minimized.

Member

andrewrk commented Jan 16, 2018

You should be good as of 84d8584

@andrewrk

This comment has been minimized.

Member

andrewrk commented Jan 16, 2018

something is not quite right, here's an example:

test "aoeu" {
    const hash1 = 0xa847d26c2f966c5c4cc222b174918a56037cdee34b3f872f;
    @compileLog(hash1);
}
$ ./zig test test.zig 
| unreachable
Aborted

Looks like bigint_rem got the wrong value for 4126227191251978491697987544882340798050766755606969681711 % 10.

@andrewrk

This comment has been minimized.

Member

andrewrk commented Jan 16, 2018

I fixed the above bug with remainder division in 6a95b88 but the blake tests when uncommented still don't pass for me. Probably there is still something wrong with bigint. See #405

@tiehuis

This comment has been minimized.

Member

tiehuis commented Jan 16, 2018

Awesome. I'll actually change the return method to fill a input slice I think. If we add extendable-output hash functions (such as SHAKE) we will want to avoid the copies anyway and the API consistency will be a bit cleaner.

tiehuis added some commits Jan 16, 2018

Change crypto functions to fill a buffer
 - Rename blake2x -> blake2
 - Fix blake2s truncated tests
@tiehuis

This comment has been minimized.

Member

tiehuis commented Jan 16, 2018

Updated all the crypto functions to fill a result buffer. All tests passing now.

@andrewrk andrewrk merged commit 8b280d5 into master Jan 16, 2018

2 of 4 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@tiehuis tiehuis deleted the blake2 branch Jan 17, 2018

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