Skip to main content

iscc_decode

Function iscc_decode 

Source
pub fn iscc_decode(iscc: &str) -> IsccResult<(u8, u8, u8, u8, Vec<u8>)>
Expand description

Decode an ISCC string into its header components and raw digest.

Normalizes the input to its canonical form first (matching iscc_core.codec.iscc_decode), then base32-decodes it, parses the variable-length header, and returns the digest.

Normalization means a concatenated sequence of ISCC-UNITs is composed into a single ISCC-CODE before decoding, so a sequence and its composite form decode identically. Trailing bytes after a composite are discarded by decomposition, exactly as in the reference.

Returns (maintype, subtype, version, length_index, digest) where the integer fields match codec::MainType, codec::SubType, and codec::Version enum values.

ยงErrors

Returns IsccError::InvalidInput on invalid base32 input, a malformed header, a body shorter than its encoded bit-length, or a unit sequence that cannot be composed into an ISCC-CODE.