aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2024-08-18 11:16:13 -0700
committerJack O'Connor <[email protected]>2024-08-18 11:32:23 -0700
commit5c4c351a1a0729f8e7a88e6895379bb952ed1a07 (patch)
treeae23751fbf5eaeaf394efd810fc578286022c722 /c
parent4386d7f0baae5cf77e319f12256bd7c91fedc1ef (diff)
make xof_many fall back to compress_xof instead of portable code
Diffstat (limited to 'c')
-rw-r--r--c/blake3_dispatch.c4
-rw-r--r--c/blake3_impl.h3
2 files changed, 6 insertions, 1 deletions
diff --git a/c/blake3_dispatch.c b/c/blake3_dispatch.c
index cf5bad7..5c76b14 100644
--- a/c/blake3_dispatch.c
+++ b/c/blake3_dispatch.c
@@ -241,7 +241,9 @@ void blake3_xof_many(const uint32_t cv[8],
}
#endif
#endif
- blake3_xof_many_portable(cv, block, block_len, counter, flags, out, outblocks);
+ for(size_t i = 0; i < outblocks; ++i) {
+ blake3_compress_xof(cv, block, block_len, counter + i, flags, out + 64*i);
+ }
}
void blake3_hash_many(const uint8_t *const *inputs, size_t num_inputs,
diff --git a/c/blake3_impl.h b/c/blake3_impl.h
index abd7546..3da773b 100644
--- a/c/blake3_impl.h
+++ b/c/blake3_impl.h
@@ -222,6 +222,9 @@ void blake3_compress_xof_portable(const uint32_t cv[8],
uint8_t block_len, uint64_t counter,
uint8_t flags, uint8_t out[64]);
+// This function is test-only. When blake3_xof_many doesn't have an optimized implementation,
+// it loops over blake3_compress_xof instead of falling back to this, so it still benefits
+// from compress optimizations.
void blake3_xof_many_portable(const uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN],
uint8_t block_len, uint64_t counter, uint8_t flags,