File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 2424
2525// typedef struct blake3_hasher PHP_BLAKE3_CTX;
2626#define PHP_BLAKE3_CTX blake3_hasher
27- // help: is V correct?
28- //#define PHP_BLAKE3_SPEC "b8b8qb64bbbbb1760"
29- #define PHP_BLAKE3_SPEC "L8L8Qa64CCCCL8Ca1760"
27+ // When testing, the compiler insert 5 alignment-padding bytes after buf_len, and 7 trailing alignment bytes at the end of the struct.
28+ // Unsure if it is portable to rely on this exact padding behavior..
29+ // If the CIs pass, I'll assume it is portable.
30+ #define PHP_BLAKE3_SPEC /* uint32_t key[8]; */ "l8" \
31+ /* uint32_t cv[8]; */ "l8" \
32+ /* uint64_t chunk_counter; */ "q" \
33+ /* uint8_t buf[BLAKE3_BLOCK_LEN]; */ "b64" \
34+ /* uint8_t buf_len; */ "b" \
35+ /* skip 5 bytes of alignment padding in chunk */ "B5" \
36+ /* uint8_t blocks_compressed */ "b" \
37+ /* uint8_t flags; */ "b" \
38+ /* uint8_t cv_stack_len; */ "b" \
39+ /* uint8_t cv_stack[(BLAKE3_MAX_DEPTH + 1) * BLAKE3_OUT_LEN]; */ "b1760" \
40+ /* skip 7 trailing alignment bytes */ "B7" \
41+ "."
42+
43+
44+
45+
46+
3047
3148PHP_HASH_API void PHP_BLAKE3Init (PHP_BLAKE3_CTX * context , HashTable * args );
3249PHP_HASH_API void PHP_BLAKE3Update (PHP_BLAKE3_CTX * context , const unsigned char * input , size_t len );
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ function not_serializable(string $algo)
4444 return in_array ($ algo , [
4545 "xxh3 " ,
4646 "xxh128 " ,
47- "blake3 " , // todo: blake3 can be seralized but it's not implemented yet
4847 ], true );
4948}
5049
@@ -180,6 +179,9 @@ string(8) "eee74423"
180179string(5) "xxh64"
181180string(16) "9d6ab4708056a619"
182181string(16) "9d6ab4708056a619"
182+ string(6) "blake3"
183+ string(64) "e232493e3d416e24ffc588b24a1772ccc6f80290f1920cf15f21313bc3543a51"
184+ string(64) "e232493e3d416e24ffc588b24a1772ccc6f80290f1920cf15f21313bc3543a51"
183185string(10) "haval128,3"
184186string(32) "86362472c8895e68e223ef8b3711d8d9"
185187string(32) "86362472c8895e68e223ef8b3711d8d9"
@@ -354,6 +356,9 @@ string(8) "3b7a100b"
354356string(5) "xxh64"
355357string(16) "5a90002ef76d172f"
356358string(16) "5a90002ef76d172f"
359+ string(6) "blake3"
360+ string(64) "dbdea45e5a6c3bad18a4f96d9d4b9105e4cceaa4fc06568f69829435c47587fb"
361+ string(64) "dbdea45e5a6c3bad18a4f96d9d4b9105e4cceaa4fc06568f69829435c47587fb"
357362string(10) "haval128,3"
358363string(32) "ebeeeb05c18af1e53d2d127b561d5e0d"
359364string(32) "ebeeeb05c18af1e53d2d127b561d5e0d"
You can’t perform that action at this time.
0 commit comments