Files
WAFER/crates/core/Cargo.toml
T
ok 0fda7e6fe8 Add extensible hash primitives: SHA1, SHA256, SHA512
Introduces a `crypto` feature (on by default) that wires the RustCrypto
sha1/sha2 crates into a small `HashAlgo` registry. `register_primitives`
iterates `crypto::ALGOS` and installs one Forth host word per algorithm,
each with the stack effect

    ( c-addr u -- c-addr2 u2 )

reading `u` bytes from `c-addr` and writing the digest into a shared
`HASH_SCRATCH` region in linear memory (carved out between the float
stack and the dictionary).

Adding a new hash is a one-line entry in `ALGOS`. `register_host_primitive`
is now `pub` so downstream crates can extend the VM with their own I/O
host words without forking WAFER — kelvar (a deterministic password
manager on WAFER) is the first consumer.

- 4 unit tests (lib-level sha1/256/512 + registry sanity)
- 5 integration tests (in-VM `SHA1`/`SHA256`/`SHA512` against RFC-3174,
  FIPS-180, and the first-round S/KEY seed used by `hel`)
- All 437 existing lib tests still pass; `wafer-web` still builds for
  `wasm32-unknown-unknown` with the feature enabled
2026-04-14 22:08:04 +02:00

28 lines
687 B
TOML

[package]
name = "wafer-core"
description = "WAFER: WebAssembly Forth Engine in Rust - core compiler and runtime"
version.workspace = true
edition.workspace = true
license.workspace = true
[lints]
workspace = true
[features]
default = ["native", "crypto"]
native = ["dep:wasmtime"]
crypto = ["dep:sha1", "dep:sha2"]
[dependencies]
wasm-encoder = { workspace = true }
wasmparser = { workspace = true }
wasmtime = { workspace = true, optional = true }
anyhow = { workspace = true }
thiserror = { workspace = true }
sha1 = { workspace = true, optional = true }
sha2 = { workspace = true, optional = true }
[dev-dependencies]
proptest = { workspace = true }
insta = { workspace = true }