Skip to main content

Crate prism_crypto

Crate prism_crypto 

Source
Expand description

Prism standard-library cryptography sub-crate.

prism-crypto realizes the cryptography Layer-3 of the standard library named in Wiki ADR-031: it declares the cryptographic axis traits (HashAxis, CurveAxis, SignatureAxis, CommitmentAxis) through the axis! SDK macro and supplies canonical impls plus matching ConstrainedTypeShape carriers per the wiki’s ADR-031 roster.

§Scope

  • HashAxis — content-addressing function. Canonical impls: Sha256Hasher, Sha512Hasher, Sha3_256Hasher, Blake3Hasher, Keccak256Hasher. Each impl is conformance-tested against the relevant standard’s published vectors (FIPS-180-4 for SHA-2, FIPS-202 for SHA-3, BLAKE3 spec for BLAKE3) — see tests/conformance.rs.
  • CommitmentAxis — composes any HashAxis impl into a Merkle-root commitment via MerkleRoot<H, LEAF_BYTES>. The default alias MerkleRootCommitment is SHA-256. Per ADR-031 this is the canonical example of standard-library cross-sub-crate composition.
  • CurveAxis, SignatureAxis — declared per ADR-031’s standard-library roster; concrete reference impls are scoped per axis maintenance policy (ADR-031’s “operational policy” carve-out).

§ConstrainedTypeShape declarations

Per ADR-031’s shape-declaration commitment, the canonical cryptographic value-carriers are parametric over byte-width:

Each shape is GroundedShape + IntoBindingValue-bound for use as the Output of a prism_model!-declared application.

§Closure under uor-foundation (ADR-013)

Every axis trait declared here has ::uor_foundation::pipeline::AxisExtension as a supertrait — the axis! macro enforces this. Concrete impls that take no type parameters use the companion-macro lane; the parametric MerkleRoot<H, LEAF_BYTES> hand-writes its AxisExtension impl since the companion macro takes :ident.

§See also

Re-exports§

pub use commitment::CommitmentAxis;
pub use commitment::MerkleProofShape;
pub use commitment::MerkleRoot;
pub use commitment::MerkleRootCommitment;
pub use commitment::MAX_MERKLE_LEAVES;
pub use curve::CurveAxis;
pub use hash::Blake3Hasher;
pub use hash::HashAxis;
pub use hash::Keccak256Hasher;
pub use hash::Sha256Hasher;
pub use hash::Sha3_256Hasher;
pub use hash::Sha512Hasher;
pub use shapes::Digest;
pub use shapes::PublicKey;
pub use shapes::Signature;
pub use signature::SignatureAxis;

Modules§

commitment
CommitmentAxis declaration, parametric Merkle reference impl, and shape carriers.
curve
CurveAxis declaration (wiki ADR-031 elliptic-curve operations).
hash
HashAxis declaration and FIPS-180-4 / FIPS-202 / BLAKE3 impls.
shapes
Parametric ConstrainedTypeShape carriers per Wiki ADR-031: Digest<N>, PublicKey<N>, Signature<N>.
signature
SignatureAxis declaration (wiki ADR-031 signing/verification).
verbs
Layer-3 substrate-Term verbs per Wiki ADR-024 + Wiki ADR-055 + Wiki ADR-056.

Macros§

axis_extension_impl_for_commitment_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).
axis_extension_impl_for_curve_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).
axis_extension_impl_for_hash_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).
axis_extension_impl_for_signature_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).

Constants§

STANDARD_LIBRARY_VERSION
Wiki ADR-031 standard-library version banner. Each prism standard- library sub-crate exposes this so application authors can introspect the canonical-reference version of the axes it declares.