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

Merged
merged 4 commits into from Jan 16, 2018
Merged

Add Blake2X hash functions #689

merged 4 commits into from Jan 16, 2018

Conversation

@tiehuis
Copy link
Member

@tiehuis 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.

The truncated output variants currently are dependent on a more complete
bigint implementation in the compiler.
@andrewrk
Copy link
Member

@andrewrk andrewrk commented Jan 15, 2018

I'll work on big int rem today

@andrewrk
Copy link
Member

@andrewrk andrewrk commented Jan 16, 2018

You should be good as of 84d8584

@andrewrk
Copy link
Member

@andrewrk 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
Copy link
Member

@andrewrk 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
Copy link
Member Author

@tiehuis 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
Copy link
Member Author

@tiehuis 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
@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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants