INNER CODE UNIT · Rust

has_tag

TheMaxMur/RS-Key · crates/rsk-devconf/src/lib.rs:408

fn has_tag(blob: &[u8], tag: u8) -> bool {
    let mut i = 0;
    while i + 1 < blob.len() {
        let end = i + 2 + blob[i + 1] as usize;
        if end > blob.len() {
            return false;
        }
        if blob[i] == tag {
            return true;
        }
        i = end;
    }
    false
}

/// Whether `blob` is a clean run of TLV entries whose every tag a host may write.
/// Empty is fine (it clears the record). Rejecting here rather than sanitizing on
/// read keeps one definition of "what a host may store" and means READ CONFIG can

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…