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 BLAKE3 hash #13194

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
187c8e9
add BLAKE3 hash
divinity76 Jan 19, 2024
14cd419
add HashTable *args
divinity76 Jan 19, 2024
fcc16d3
update github verify-generated-files
divinity76 Jan 19, 2024
bf8a527
(hopefully) fix MSVC build
divinity76 Jan 19, 2024
6634154
attempt MSVC fix
divinity76 Jan 19, 2024
6f40213
disable ARM Neon optimizations
divinity76 Jan 19, 2024
882466b
enable ARM Neon optimizations (tested on Oracle Cloud)
divinity76 Jan 19, 2024
61f4b26
Merge branch 'master' into hash-blake3
divinity76 Jan 29, 2024
012d660
fix path
divinity76 Jan 29, 2024
de9e7e9
Update ext/hash/config.w32
divinity76 Jan 29, 2024
6693562
remove unused file libblake3.pc.in
divinity76 Jan 30, 2024
ab2229e
Merge branch 'php:master' into hash-blake3
divinity76 Jan 30, 2024
2a040f7
Delete ext/hash/blake3/upstream_blake3/c/libblake3.pc.in
divinity76 Jan 30, 2024
9439644
add blake3 LICENSE
divinity76 Feb 2, 2024
d704780
Update ext/hash/config.m4
divinity76 Feb 3, 2024
f12caf0
Update ext/hash/config.m4
divinity76 Feb 3, 2024
1954b37
license headers
divinity76 Feb 3, 2024
9504fa1
php patches + optimized checkout
divinity76 Feb 4, 2024
2a2b5ad
Merge branch 'php:master' into hash-blake3
divinity76 Feb 7, 2024
06e5a75
Merge branch 'php:master' into hash-blake3
divinity76 Feb 8, 2024
ad9c31e
Merge branch 'php:master' into hash-blake3
divinity76 Feb 9, 2024
09a34ef
optimize neon loadu_128/storeu_128
divinity76 Feb 9, 2024
c9678bf
Merge branch 'master' into hash-blake3
divinity76 Jan 22, 2025
1f14967
update upstream blake3 1.5.5
divinity76 Jan 22, 2025
59be6da
apply https://github.com/BLAKE3-team/BLAKE3/pull/443
divinity76 Jan 22, 2025
2ed54b7
re-run CI (random MacOS timeout error, not my fault)
divinity76 Jan 22, 2025
b3e063e
remove controversial fetch_upstream_blake3.sh
divinity76 Jan 22, 2025
2bb1af7
Update ext/hash/hash_blake3.c
divinity76 Jan 24, 2025
cafc856
Update ext/hash/tests/hash_hmac_algos.phpt
divinity76 Jan 24, 2025
113c1fd
nits from review
divinity76 Jan 24, 2025
896351a
re-run CI (random network failure)
divinity76 Jan 24, 2025
8762e32
try to fix serialization
divinity76 Jan 24, 2025
b7f46f8
serialization still broken on 32bit
divinity76 Jan 24, 2025
263b2f6
attempt 32bit serialization fix
divinity76 Jan 24, 2025
afc0744
re-run CI (windows CI network failure)
divinity76 Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/verify-generated-files/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ runs:
ext/tokenizer/tokenizer_data_gen.php
build/gen_stub.php -f
build/gen_stub.php --generate-optimizer-info
ext/hash/blake3/fetch_upstream_blake3.sh
git add . -N && git diff --exit-code
95 changes: 95 additions & 0 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2846,3 +2846,98 @@ AC_DEFUN([PHP_CHECK_AVX512_VBMI_SUPPORTS], [
AC_DEFINE_UNQUOTED([PHP_HAVE_AVX512_VBMI_SUPPORTS],
[$have_avx512_vbmi_supports], [Whether the compiler supports AVX512 VBMI])
])


dnl PHP_CHECK_ARM_NEON_SUPPORT
dnl check if we're compiling for ARM NEON
AC_DEFUN([PHP_CHECK_ARM_NEON_SUPPORT], [
AC_CACHE_CHECK([for ARM NEON support],ac_cv_target_arm_neon,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
int main(void) {
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
return 0;
#else
return 1;
#endif
}
]])],[
ac_cv_target_arm_neon=yes
],[
ac_cv_target_arm_neon=no
],[
ac_cv_target_arm_neon=no
])])
])


dnl
dnl PHP_CHECK_X86_TARGET
dnl
dnl check if we're compiling for x86/x86_64
dnl
AC_DEFUN([PHP_CHECK_X86_TARGET], [
AC_CACHE_CHECK([for x86 target],ac_cv_target_x86,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
int main(void) {
#if defined(__x86_64__) || defined(__i386__)
return 0;
#else
return 1;
#endif
}
]])],[
ac_cv_target_x86=yes
],[
ac_cv_target_x86=no
],[
ac_cv_target_x86=no
])])
])

dnl
dnl PHP_CHECK_WINDOWS_TARGET
dnl
dnl check if we're compiling for windows
dnl
AC_DEFUN([PHP_CHECK_WINDOWS_TARGET], [
AC_CACHE_CHECK([for windows target],ac_cv_target_windows,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
int main(void) {
#if defined(_WIN32)
return 0;
#else
return 1;
#endif
}
]])],[
ac_cv_target_windows=yes
],[
ac_cv_target_windows=no
],[
ac_cv_target_windows=no
])])
])

dnl
dnl PHP_CHECK_UNIX_TARGET
dnl
dnl check if we're compiling for a unix-ish target
dnl
AC_DEFUN([PHP_CHECK_UNIX_TARGET], [
AC_CACHE_CHECK([for unix-ish target],ac_cv_target_unix,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
int main(void) {
#if defined(unix) || defined(__unix) || defined(__unix__)
return 0;
#else
return 1;
#endif
}
]])],[
ac_cv_target_unix=yes
],[
ac_cv_target_unix=no
],[
ac_cv_target_unix=no
])])
])
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,19 @@ PHP_EBCDIC
dnl Check whether the system byte ordering is bigendian.
PHP_C_BIGENDIAN

dnl Check if we're targeting x86 / x86_64
PHP_CHECK_X86_TARGET

dnl Check if we're targeting ARM Neon CPUs
PHP_CHECK_ARM_NEON_SUPPORT


dnl Check if we're targeting Windows
PHP_CHECK_WINDOWS_TARGET

dnl Check whether we're targeting a unix-ish system
PHP_CHECK_UNIX_TARGET

dnl Check whether writing to stdout works.
PHP_TEST_WRITE_STDOUT

Expand Down
13 changes: 13 additions & 0 deletions ext/hash/blake3/fetch_upstream_blake3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
divinity76 marked this conversation as resolved.
Show resolved Hide resolved
divinity76 marked this conversation as resolved.
Show resolved Hide resolved
# afaik the PHP project doesn't allow git submodules, so we do this fetcher script instead.
cd "$(dirname "$0")"
rm -rf upstream_blake3
# fancy way of just fetching the "c" folder (the only thing we want)
git clone --branch '1.5.0' -n --depth=1 --filter=tree:0 'https://github.com/BLAKE3-team/BLAKE3.git' 'upstream_blake3'
cd upstream_blake3
git sparse-checkout set --no-cone c
git checkout
rm -rf .git
cd c
# some stuff we don't need
rm -rf blake3_c_rust_bindings test.py example.c main.c Makefile.testing CMakeLists.txt blake3-config.cmake.in README.md .gitignore
divinity76 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading