@iocium/domhash
    Preparing search index...

    @iocium/domhash

    @iocium/domhash

    Structure-aware and layout-aware perceptual hashing for HTML and DOM content.

    npm version License: MIT CI


    • Structural and visual similarity detection for DOM trees
    • Layout-aware hashing using tag display roles (block, inline, etc.)
    • Supports perceptual hash algorithms: sha256, murmur3, blake3, simhash, minhash
    • Resilience scoring to detect obfuscated or fragile DOMs
    • Rich CLI and programmatic API
    • Markdown and HTML output with structural diffs
    • 100% test coverage

    npm install @iocium/domhash
    

    npx domhash <input> [options]
    
    Option Description
    --algo <type> Choose hashing algorithm
    --include <attrs> Comma-separated list of attributes to include
    --shape Output tag shape vector
    --layoutAware Enable layout-based canonicalization
    --resilience Output a resilience score
    --compare <input> Compare against another HTML or URL
    --diff Show structural diff
    --output <type> Output format: json, markdown, html

    import { domhash, computeResilienceScore, compareStructures } from '@iocium/domhash';

    const result = await domhash('<form><input></form>', {
    layoutAware: true,
    resilience: true,
    shapeVector: true,
    includeAttributes: ['action']
    });

    console.log(result.hash); // structure hash
    console.log(result.layoutHash); // layout-aware hash
    console.log(result.resilienceScore); // between 0 and 1
    console.log(result.shape); // tag structure vector

    ### DOM Hash Comparison Report
    
    - SHA A: `abc123`
    - SHA B: `def456`
    - Structural Similarity: `91.25%`
    - Shape Similarity: `88.00%`
    
    **Structural Diff:**
    
    ```diff
    - <p></p>
    + <span></span>
    

    MIT License — see LICENSE for full terms.


    Made with 💙 by iocium