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 24
24
25
25
// typedef struct blake3_hasher PHP_BLAKE3_CTX;
26
26
#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
+
30
47
31
48
PHP_HASH_API void PHP_BLAKE3Init (PHP_BLAKE3_CTX * context , HashTable * args );
32
49
PHP_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)
44
44
return in_array ($ algo , [
45
45
"xxh3 " ,
46
46
"xxh128 " ,
47
- "blake3 " , // todo: blake3 can be seralized but it's not implemented yet
48
47
], true );
49
48
}
50
49
@@ -180,6 +179,9 @@ string(8) "eee74423"
180
179
string(5) "xxh64"
181
180
string(16) "9d6ab4708056a619"
182
181
string(16) "9d6ab4708056a619"
182
+ string(6) "blake3"
183
+ string(64) "e232493e3d416e24ffc588b24a1772ccc6f80290f1920cf15f21313bc3543a51"
184
+ string(64) "e232493e3d416e24ffc588b24a1772ccc6f80290f1920cf15f21313bc3543a51"
183
185
string(10) "haval128,3"
184
186
string(32) "86362472c8895e68e223ef8b3711d8d9"
185
187
string(32) "86362472c8895e68e223ef8b3711d8d9"
@@ -354,6 +356,9 @@ string(8) "3b7a100b"
354
356
string(5) "xxh64"
355
357
string(16) "5a90002ef76d172f"
356
358
string(16) "5a90002ef76d172f"
359
+ string(6) "blake3"
360
+ string(64) "dbdea45e5a6c3bad18a4f96d9d4b9105e4cceaa4fc06568f69829435c47587fb"
361
+ string(64) "dbdea45e5a6c3bad18a4f96d9d4b9105e4cceaa4fc06568f69829435c47587fb"
357
362
string(10) "haval128,3"
358
363
string(32) "ebeeeb05c18af1e53d2d127b561d5e0d"
359
364
string(32) "ebeeeb05c18af1e53d2d127b561d5e0d"
You can’t perform that action at this time.
0 commit comments