Skip to content

Commit 9adf667

Browse files
committed
feat: add support for BLAKE3-256 hash
1 parent cb22339 commit 9adf667

15 files changed

+201
-59
lines changed

.docker/Dockerfile.arch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# syntax=docker/dockerfile:1
22
FROM archlinux:latest
3-
RUN pacman -Syu --noconfirm
4-
RUN pacman -S --noconfirm --needed \
3+
RUN pacman -Syu --noconfirm && \
4+
pacman -S --noconfirm --needed \
55
bash-completion \
66
vim \
77
devtools \
8-
less
9-
RUN pacman -S --noconfirm --needed \
8+
less \
109
gcc \
1110
clang \
1211
man \
@@ -26,6 +25,7 @@ RUN pacman -S --noconfirm --needed \
2625
pkg-config \
2726
binutils \
2827
libarchive \
28+
libblake3 \
2929
benchmark \
3030
boost \
3131
brotli \

.docker/Dockerfile.debian

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# syntax=docker/dockerfile:1
22
ARG ARCH=amd64
33
FROM $ARCH/debian:testing
4-
RUN apt update && apt upgrade -y
5-
RUN apt install -y \
4+
RUN apt update && apt upgrade -y && \
5+
apt install -y \
66
bash-completion \
77
wget \
88
curl \

.docker/Dockerfile.fedora

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# syntax=docker/dockerfile:1
22
ARG ARCH=amd64
33
FROM $ARCH/fedora:rawhide
4-
RUN dnf update -y
5-
RUN dnf install -y \
4+
RUN dnf update -y && \
5+
dnf install -y \
66
bash-completion \
77
vim \
8-
less
9-
RUN dnf install -y \
8+
less \
109
gcc \
1110
g++ \
1211
clang \
@@ -27,6 +26,7 @@ RUN dnf install -y \
2726
pkg-config \
2827
binutils-devel \
2928
libarchive-devel \
29+
blake3-devel \
3030
google-benchmark \
3131
boost-devel \
3232
brotli-devel \

.docker/Dockerfile.suse

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
FROM opensuse/tumbleweed
33

44
# Refresh & update the base. For Tumbleweed, a normal update is fine in a fresh image.
5-
RUN zypper -n refresh && zypper -n update
6-
7-
# Nice-to-haves
8-
RUN zypper -n in --no-recommends \
5+
RUN zypper -n refresh && zypper -n update &&
6+
zypper -n in --no-recommends \
97
bash-completion \
108
vim \
11-
less
12-
13-
# Build toolchain & essentials
14-
RUN zypper -n in --no-recommends \
9+
less \
1510
mold \
1611
gcc \
1712
gcc-c++ \
@@ -33,6 +28,7 @@ RUN zypper -n in --no-recommends \
3328
pkgconf-pkg-config \
3429
binutils-devel \
3530
libarchive-devel \
31+
blake3-devel \
3632
benchmark-devel \
3733
boost-devel \
3834
libboost_chrono-devel \

.docker/check_lib_versions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"xiph/flac",
99
"libunwind/libunwind",
1010
"google/benchmark",
11+
"BLAKE3-team/BLAKE3",
1112
"boostorg/boost",
1213
"openssl/openssl",
1314
"libressl/portable",

.docker/static-libs-fetch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fetch_lib flac https://github.com/xiph/flac/releases/download/${FLAC_VERSION}/${
2222
fetch_lib libucontext https://github.com/kaniini/libucontext/archive/refs/tags/${LIBUCONTEXT_TARBALL}
2323
fetch_lib libunwind https://github.com/libunwind/libunwind/releases/download/v${LIBUNWIND_VERSION}/${LIBUNWIND_TARBALL}
2424
fetch_lib benchmark https://github.com/google/benchmark/archive/refs/tags/v${BENCHMARK_VERSION}.tar.gz ${BENCHMARK_TARBALL}
25+
fetch_lib blake3 https://github.com/BLAKE3-team/BLAKE3/archive/refs/tags/${BLAKE3_VERSION}.tar.gz ${BLAKE3_TARBALL}
2526
fetch_lib openssl https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VERSION}/${OPENSSL_TARBALL}
2627
fetch_lib libressl https://github.com/libressl/portable/releases/download/v${LIBRESSL_VERSION}/${LIBRESSL_TARBALL}
2728
fetch_lib cpptrace https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v${CPPTRACE_VERSION}.tar.gz ${CPPTRACE_TARBALL}

.docker/static-libs-install.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [[ "$PKGS" == ":none" ]]; then
1818
echo "No libraries to build"
1919
exit 0
2020
elif [[ "$PKGS" == ":all" ]]; then
21-
PKGS="benchmark,boost,brotli,cpptrace,double-conversion,flac,fmt,fuse,fuse3,glog,jemalloc,libarchive,libdwarf,libevent,libucontext,libunwind,libressl,lz4,mimalloc,nlohmann,openssl,parallel-hashmap,range-v3,utfcpp,xxhash,xz,zstd"
21+
PKGS="benchmark,blake3,boost,brotli,cpptrace,double-conversion,flac,fmt,fuse,fuse3,glog,jemalloc,libarchive,libdwarf,libevent,libucontext,libunwind,libressl,lz4,mimalloc,nlohmann,openssl,parallel-hashmap,range-v3,utfcpp,xxhash,xz,zstd"
2222
fi
2323

2424
export COMMON_CFLAGS="-ffunction-sections -fdata-sections -fmerge-all-constants"
@@ -270,6 +270,18 @@ if use_lib nlohmann; then
270270
cp "$HOME/pkgs/json.hpp" "$INSTALL_DIR/include/nlohmann/json.hpp"
271271
fi
272272

273+
if use_lib blake3; then
274+
opt_size
275+
cd "$WORKDIR"
276+
tar xf ${WORKROOT}/${BLAKE3_TARBALL}
277+
cd BLAKE3-${BLAKE3_VERSION}/c
278+
mkdir build
279+
cd build
280+
cmake .. -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" ${CMAKE_ARGS}
281+
$NINJA_PARALLEL
282+
ninja install
283+
fi
284+
273285
if use_lib utfcpp; then
274286
opt_size
275287
cd "$WORKDIR"

.docker/static-libs-versions.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ FLAC_VERSION=1.5.0 # 2025-02-11
77
LIBUCONTEXT_VERSION=1.3.2 # 2024-10-07
88
LIBUNWIND_VERSION=1.8.3 # 2025-09-04
99
BENCHMARK_VERSION=1.9.4 # 2025-05-19
10+
BLAKE3_VERSION=1.8.2 # 2025-04-21
1011
BOOST_VERSION=1.89.0 # 2025-08-14
1112
OPENSSL_VERSION=3.6.0 # 2025-10-01
1213
LIBRESSL_VERSION=4.2.1 # 2025-10-30
@@ -38,6 +39,7 @@ FLAC_TARBALL="flac-${FLAC_VERSION}.tar.xz"
3839
LIBUCONTEXT_TARBALL="libucontext-${LIBUCONTEXT_VERSION}.tar.gz"
3940
LIBUNWIND_TARBALL="libunwind-${LIBUNWIND_VERSION}.tar.gz"
4041
BENCHMARK_TARBALL="benchmark-${BENCHMARK_VERSION}.tar.gz"
42+
BLAKE3_TARBALL="BLAKE3-${BLAKE3_VERSION}.tar.gz"
4143
OPENSSL_TARBALL="openssl-${OPENSSL_VERSION}.tar.gz"
4244
LIBRESSL_TARBALL="libressl-${LIBRESSL_VERSION}.tar.gz"
4345
CPPTRACE_TARBALL="cpptrace-${CPPTRACE_VERSION}.tar.gz"

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ set(RANGE_V3_PREFERRED_VERSION 0.12.0)
109109
set(PARALLEL_HASHMAP_REQUIRED_VERSION 1.3.8)
110110
set(PARALLEL_HASHMAP_PREFERRED_VERSION 2.0.0)
111111

112+
set(BLAKE3_REQUIRED_VERSION 1.2.0)
113+
set(BLAKE3_PREFERRED_VERSION 1.8.2)
114+
112115
set(BOOST_REQUIRED_VERSION 1.67.0)
113116
set(LIBCRYPTO_REQUIRED_VERSION 3.0.0)
114117
set(LIBLZ4_REQUIRED_VERSION 1.9.3)
@@ -127,11 +130,13 @@ if(DEFINED ENV{DWARFS_LOCAL_REPO_PATH})
127130
set(GOOGLETEST_GIT_REPO $ENV{DWARFS_LOCAL_REPO_PATH}/googletest)
128131
set(RANGE_V3_GIT_REPO $ENV{DWARFS_LOCAL_REPO_PATH}/range-v3)
129132
set(PARALLEL_HASHMAP_GIT_REPO $ENV{DWARFS_LOCAL_REPO_PATH}/parallel-hashmap)
133+
set(BLAKE3_GIT_REPO $ENV{DWARFS_LOCAL_REPO_PATH}/BLAKE3)
130134
else()
131135
set(LIBFMT_GIT_REPO https://github.com/fmtlib/fmt.git)
132136
set(GOOGLETEST_GIT_REPO https://github.com/google/googletest.git)
133137
set(RANGE_V3_GIT_REPO https://github.com/ericniebler/range-v3.git)
134138
set(PARALLEL_HASHMAP_GIT_REPO https://github.com/greg7mdp/parallel-hashmap.git)
139+
set(BLAKE3_GIT_REPO https://github.com/BLAKE3-team/BLAKE3.git)
135140
endif()
136141

137142
if(APPLE)
@@ -194,6 +199,7 @@ if(WITH_TESTS)
194199
include(${CMAKE_SOURCE_DIR}/cmake/need_gtest.cmake)
195200
endif()
196201

202+
include(${CMAKE_SOURCE_DIR}/cmake/need_blake3.cmake)
197203
include(${CMAKE_SOURCE_DIR}/cmake/need_fmt.cmake)
198204
include(${CMAKE_SOURCE_DIR}/cmake/need_range_v3.cmake)
199205

cmake/libdwarfs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ add_cpp2_thrift_library(thrift/history.thrift
208208
add_cpp2_thrift_library(thrift/features.thrift
209209
TARGET dwarfs_features_thrift OUTPUT_PATH dwarfs)
210210

211-
target_link_libraries(dwarfs_common PRIVATE dwarfs_folly_lite PkgConfig::LIBCRYPTO PkgConfig::XXHASH PkgConfig::ZSTD)
211+
target_link_libraries(dwarfs_common PRIVATE dwarfs_folly_lite PkgConfig::LIBCRYPTO PkgConfig::XXHASH PkgConfig::ZSTD BLAKE3::blake3)
212212
target_link_libraries(dwarfs_compressor PRIVATE dwarfs_common)
213213
target_link_libraries(dwarfs_decompressor PRIVATE dwarfs_common)
214214
target_link_libraries(dwarfs_reader PUBLIC dwarfs_common dwarfs_decompressor)

0 commit comments

Comments
 (0)