MARS documentation
Rust librariesmars-protocol

mars-protocol · hash

Public declarations and documentation for mars-protocol::hash.

Package: mars-protocol · Workspace version: 0.1.0 · Module: hash

This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.

hash::compute_item_data_hash

Compute the sha256:<hex> hash of item_data in canonical (JCS) form.

Errors

Returns [crate::errors::MarsError::ValidationError] if JCS serialization fails.

pub fn compute_item_data_hash(
    item_data: &serde_json::Value,
) -> Result<String, crate::errors::MarsError>;

Source line: 13.

hash::verify_item_data_hash

Verify that expected_hash matches the hash of item_data.

Errors

Returns [crate::errors::MarsError::HashMismatch] on mismatch.

pub fn verify_item_data_hash(
    item_data: &serde_json::Value,
    expected_hash: &str,
) -> Result<(), crate::errors::MarsError>;

Source line: 32.

hash::hex::encode

pub fn encode(bytes: impl AsRef<[u8]>) -> String;

Source line: 50.

Source provenance

Source: mars-protocol/src/hash.rs · SHA-256 8b7e3e5b2756b7b0ba1b48089d8efccb54a5bc08c781fd96bfdecaaa1e0eaaf5. Package overview.

On this page