+18
LICENSE.md
+18
LICENSE.md
···
+163
-1
README.md
+163
-1
README.md
···+- **Hardware acceleration**: Automatically detects and uses CPU SHA extensions (Intel SHA-NI, ARM Crypto)+- **Memory-mapped files**: sha256sum example uses `Unix.map_file` for true zero-copy file hashing+The library automatically detects your CPU architecture at build time and enables hardware SHA acceleration:+A drop-in replacement for the `sha256sum` command that uses memory-mapped files for zero-copy hashing:+The sha256sum example demonstrates true zero-copy file hashing by memory-mapping files directly into bigarrays.+The library uses Brad Conte's public domain SHA256 implementation. The C context is allocated on the C heap and wrapped in an OCaml custom block with proper finalization.+The build system uses `dune-configurator` to detect the CPU architecture and automatically add the appropriate compiler flags for hardware SHA acceleration. The configurator script (`lib/discover/discover.ml`) runs during the build and generates a `c_flags.sexp` file that dune includes in the C compilation flags.
-173
bench/bench_sha256.ml
-173
bench/bench_sha256.ml
···
-4
bench/dune
-4
bench/dune
+53
bin/osha256sum.ml
+53
bin/osha256sum.ml
···
+12
-9
dune-project
+12
-9
dune-project
···-(description "Hardware-accelerated SHA256 implementation for OxCaml using AMD SHA-NI instructions with zero-allocation design")+(description "OCaml bindings to a C SHA256 implementation using bigarrays for efficient, zero-copy hashing")
+20
lib/discover/discover.ml
+20
lib/discover/discover.ml
···
+13
-5
lib/dune
+13
-5
lib/dune
···
+56
lib/oxsha.ml
+56
lib/oxsha.ml
···
+89
lib/oxsha.mli
+89
lib/oxsha.mli
···
+92
lib/oxsha_stubs.c
+92
lib/oxsha_stubs.c
···
+638
lib/sha256.c
+638
lib/sha256.c
···+#if defined(__arm__) || defined(__aarch32__) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM)
+35
lib/sha256.h
+35
lib/sha256.h
···
-96
lib/sha256.ml
-96
lib/sha256.ml
···
-47
lib/sha256.mli
-47
lib/sha256.mli
···
-382
lib/sha256_stubs.c
-382
lib/sha256_stubs.c
···
+32
oxsha.opam
+32
oxsha.opam
···
+3
-4
test/dune
+3
-4
test/dune
+171
test/speed_test.ml
+171
test/speed_test.ml
···
-124
test/test_sha256.ml
-124
test/test_sha256.ml
···-let buffer = Bigarray.Array1.create Bigarray.int8_unsigned Bigarray.c_layout (String.length data) in