rvf-crypto
Cryptographic primitives for RuVector Format -- SHA-3 hashing and Ed25519 signing.
Overview
rvf-crypto provides the cryptographic building blocks used by RVF for data integrity and authentication:
- SHA-3 hashing -- content-addressable segment identifiers
- Ed25519 signing -- segment-level digital signatures for provenance
- Key management -- keypair generation and verification utilities
Usage
[]
= "0.1"
Features
std(default) -- enablestdsupport
Lineage Witness Functions
rvf-crypto provides the cryptographic functions for DNA-style lineage provenance chains.
lineage_record_to_bytes() / lineage_record_from_bytes()
Serialize and deserialize a LineageRecord to/from a fixed 128-byte array. The codec preserves all fields including the 47-byte description buffer:
use ;
use ;
let record = new;
let bytes = lineage_record_to_bytes;
let decoded = lineage_record_from_bytes.unwrap;
assert_eq!;
lineage_witness_entry()
Creates a WitnessEntry for a derivation event. The action_hash is the SHAKE-256-256 digest of the serialized 128-byte record. Uses witness type WITNESS_DERIVATION (0x09):
use lineage_witness_entry;
let entry = lineage_witness_entry;
assert_eq!;
compute_manifest_hash()
Computes SHAKE-256-256 over a 4096-byte manifest for use as parent_hash in FileIdentity:
use compute_manifest_hash;
let manifest = ;
let hash = compute_manifest_hash;
verify_lineage_chain()
Validates a lineage chain from root to leaf. For each child entry it checks:
parent_idmatches the parent'sfile_idparent_hashmatches the parent's manifest hashlineage_depthincrements by exactly 1
Returns Err(LineageBroken) or Err(ParentHashMismatch) on failure:
use verify_lineage_chain;
use FileIdentity;
let root = new_root;
let root_hash = ;
let child = FileIdentity ;
verify_lineage_chain.unwrap;
License
MIT OR Apache-2.0