The C implementation originates from https://github.com/BLAKE3-team/BLAKE3/tree/1.3.1/c
License is at https://github.com/BLAKE3-team/BLAKE3/blob/1.3.1/LICENSE
This patch adds:
- llvm/include/llvm-c/blake3.h: The BLAKE3 C API with certain changes (details below)
- llvm/include/llvm/Support/BLAKE3.h: C++ wrapper of the C API
- llvm/lib/Support/BLAKE3: Directory containing the BLAKE3 C implementation files, including the LICENSE file
- llvm/unittests/Support/BLAKE3Test.cpp: unit tests for the BLAKE3 C++ wrapper
Changes from original BLAKE3 sources:
- README.md: added a note about where the sources originated from
- blake.h:
- Changes to avoid conflicts if a client also links with its own BLAKE3 version:
- Renamed the header macro guard with LLVM_C_ prefix
- Renamed the C symbols to add the llvm_ prefix
- Added a top header comment that references the CC0 license
- Changes to avoid conflicts if a client also links with its own BLAKE3 version:
- blake3_impl.h: Added #defines to remove some of llvm_ prefixes for the rest of the internal implementation.
- Implementation files:
- Used llvm_ prefix for the C public API functions
- Used LLVM_LIBRARY_VISIBILITY for internal implementation functions
- Added .private_extern/.hidden in assembly files to reduce visibility of the internal implementation functions
And here's some timings comparing BLAKE3 with LLVM's SHA1/SHA256/MD5.
The table shows the speed-up multiplier of BLAKE3 for hashing 100 MBs:
Processor | SHA1 | SHA256 | MD5 |
:------------: | :----: | :------: | :----: |
Intel Xeon W | 6.5x | 17x | 5.9x |
M1Pro | 2.1x | 4.7x | 2.8x |
Please add the correct license boilerplate to this file. Plz point to the license file in the lib directory.