1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-19 09:06:05 +02:00
Commit Graph

16 Commits

Author SHA1 Message Date
Hans Henrik Bergan a2f9515785 add blake3_version(void) / BLAKE3_VERSION_STRING
related discussion here: https://github.com/BLAKE3-team/BLAKE3/issues/130
2020-10-29 23:18:34 +01:00
Jack O'Connor 0b13637ae3 fix a couple of big-endianness mistakes in blake3.c
Kudos to @pascal-cuoq and @jakub-zwolakowski from TrustInSoft for
catching these bugs.

Original report: https://github.com/BLAKE3-team/BLAKE3/pull/118
2020-09-29 16:09:28 -04:00
Renzo Carbonara b205e0efa1 C: rename blake3_hasher_init_derive_key_raw and documentation 2020-09-01 13:20:16 +03:00
Renzo Carbonara 31e4080aa2 C: Add blake3_hasher_init_derive_key_len
blake3_hasher_init_derive_key_len is an alternative version of
blake3_hasher_init_derive_key which takes the context and its
length as separate parameters, and not together as a C string.

The motivation for this addition is making it easier for
bindings to this C library to call this function without
having to first copy over the context bytes just to add
one 0x00 byte at the end.

Notice that contrary to blake3_hasher_init_derive_key,
blake3_hasher_init_derive_key_len allows the inclusion of a
0x00 byte in the context. Given the rules about context string
selection, this byte is unlikely to be used as part of a context
string. But if for some reason it is ever given, it will be
included in the context string and processed like any other
non-alphanumeric byte would. For compatibility with
blake3_hasher_init_derive_key, bindings should still check for
the absence of 0x00 bytes.
2020-08-30 12:27:33 +03:00
Jack O'Connor c908847c3f shrink a stack array that's twice as big as it needs to be
It looks like I originally made this mistake when I was copying code
from the baokeshed prototype (a274a9b0fa),
and then it got replicated into the C implementation later.
2020-06-26 16:16:55 -04:00
Samuel Neves eec458d03e move prototypes to shared header file, and make all local functions static. 2020-03-31 21:21:08 +01:00
Jack O'Connor a4ceef3932 add blake3_hasher_finalize_seek to the C API 2020-03-25 17:11:36 -04:00
Jack O'Connor 9d77bd6958 correct a comment 2020-03-17 14:26:39 -04:00
Jack O'Connor 0432f9c7a3 some comment typos 2020-02-27 09:52:46 -05:00
Jack O'Connor 8d84cfc0af remove a mis-optimization that hurt performance for uneven updates
If the total number of chunks hashed so far is e.g. 1, and update() is
called with e.g. 8 more chunks, we can't compress all 8 together. We
have to break the input up, to make sure that that 1 lone chunk CV gets
merged with its proper sibling, and that in general the correct layout
of the tree is preserved. What we should do is hash 1-2-4-1 chunks of
input, using increasing powers of 2 (with some cleanup at the end). What
we were doing was 2-2-2-2 chunks. This was the result of a mistaken
optimization that got us stuck with an always-odd number of chunks so
far.

Fixes https://github.com/BLAKE3-team/BLAKE3/issues/69.
2020-02-25 11:40:37 -05:00
Samuel Neves 37ea737c16 more robust bit-trickery functions 2020-01-23 10:58:45 +00:00
Jack O'Connor 163f52245d port compress_subtree_to_parent_node from Rust to C
This recursive function performs parallel parent node hashing, which is
an important optimization.
2020-01-22 21:32:39 -05:00
Jack O'Connor 087d72e08f clang-format 2020-01-22 21:32:35 -05:00
Jack O'Connor d7d71b2c5f move 0-length checks to the top-level C API functions 2020-01-10 10:49:33 -05:00
Guido Vranken 253e830c26 C impl: Prevent memcpy undefined behavior 2020-01-10 10:41:35 -05:00
Jack O'Connor a7579d30ad merge BLAKE3-c into this repo
This is commit 4476d9da0e370993823e7ad17592b84e905afd76 of
https://github.com/veorq/BLAKE3-c.
2020-01-09 09:48:52 -05:00