1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-09 03:26:16 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Henrik Gaßmann c50d92cc31
Merge ec244b29a2 into 4ec3be8bfa 2024-04-06 12:04:04 +08:00
Jack O'Connor 4ec3be8bfa format the state matrix better in reference_impl.rs 2024-03-20 15:44:05 -07:00
Henrik S. Gaßmann ec244b29a2 Rewrite C readme to mention vcpkg port and CMake 2023-06-19 22:48:02 +02:00
2 changed files with 29 additions and 25 deletions

View File

@ -207,14 +207,27 @@ smell](https://en.wikipedia.org/wiki/Design_smell) in any case.
# Building
This implementation is just C and assembly files. It doesn't include a
public-facing build system. (The `Makefile` in this directory is only
for testing.) Instead, the intention is that you can include these files
in whatever build system you're already using. This section describes
the commands your build system should execute, or which you can execute
by hand. Note that these steps may change in future versions.
This implementation is just C and assembly files. It comes with a CMake
buildsystem even though you can simply include the source files in
whatever build system you're already using. (The `Makefile` in this
directory is only for testing.) This section is split in two parts; the
first describes how to use the CMake buildsystem while the second
specifies the commands necessary to build the library by hand with gcc
for various platforms (you may use these as a guideline for integrating
the source files into your own buildsystem). Note that these steps may
change in future versions.
## x86
If you use the [vcpkg](https://vcpkg.io/) as your package manager, you
can simply reference the `blake3` port from your manifest or install it
via `./vcpkg install blake3`
## CMake
### CMake Options
## Manual Build Instructions
### x86
Dynamic dispatch is enabled by default on x86. The implementation will
query the CPU at runtime to detect SIMD support, and it will use the
@ -268,7 +281,7 @@ gcc -shared -O3 -o libblake3.so -DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_A
-DBLAKE3_NO_AVX512 blake3.c blake3_dispatch.c blake3_portable.c
```
## ARM NEON
### ARM NEON
The NEON implementation is enabled by default on AArch64, but not on
other ARM targets, since not all of them support it. To enable it, set
@ -300,7 +313,7 @@ in call to always_inline vaddq_u32: target specific option mismatch
...then you may need to add something like `-mfpu=neon-vfpv4
-mfloat-abi=hard`.
## Other Platforms
### Other Platforms
The portable implementation should work on most other architectures. For
example:

View File

@ -78,23 +78,14 @@ fn compress(
block_len: u32,
flags: u32,
) -> [u32; 16] {
let counter_low = counter as u32;
let counter_high = (counter >> 32) as u32;
#[rustfmt::skip]
let mut state = [
chaining_value[0],
chaining_value[1],
chaining_value[2],
chaining_value[3],
chaining_value[4],
chaining_value[5],
chaining_value[6],
chaining_value[7],
IV[0],
IV[1],
IV[2],
IV[3],
counter as u32,
(counter >> 32) as u32,
block_len,
flags,
chaining_value[0], chaining_value[1], chaining_value[2], chaining_value[3],
chaining_value[4], chaining_value[5], chaining_value[6], chaining_value[7],
IV[0], IV[1], IV[2], IV[3],
counter_low, counter_high, block_len, flags,
];
let mut block = *block_words;