Files
WAFER/Cargo.toml
T
ok2 55caf38ab5 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

53 lines
1.2 KiB
TOML

[workspace]
members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
repository = "https://github.com/ok2/wafer"
[workspace.lints.rust]
unsafe_code = "deny"
unused_must_use = "deny"
elided_lifetimes_in_paths = "warn"
trivial_numeric_casts = "warn"
unreachable_pub = "warn"
unused_qualifications = "warn"
[workspace.lints.clippy]
# Pedantic group (selective)
cloned_instead_of_copied = "warn"
explicit_iter_loop = "warn"
flat_map_option = "warn"
implicit_clone = "warn"
inconsistent_struct_constructor = "warn"
inefficient_to_string = "warn"
manual_let_else = "warn"
map_unwrap_or = "warn"
redundant_closure_for_method_calls = "warn"
semicolon_if_nothing_returned = "warn"
uninlined_format_args = "warn"
unnested_or_patterns = "warn"
unused_self = "warn"
# Correctness & suspicious
doc_markdown = "warn"
match_wildcard_for_single_variants = "warn"
needless_continue = "warn"
ref_as_ptr = "warn"
# Nursery (stable enough to use)
needless_collect = "warn"
or_fun_call = "warn"
[workspace.dependencies]
wasm-encoder = "0.246"
wasmparser = "0.246"
wasmtime = "43"
anyhow = "1"
thiserror = "2"
proptest = "1"
insta = "1"
sha1 = "0.11"
sha2 = "0.11"