contenthash

package
v0.0.0-...-0b2e453 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher struct{}

Hasher provides deterministic content hashing

func New

func New() *Hasher

New creates a new Hasher

func (*Hasher) HashBytes

func (h *Hasher) HashBytes(b []byte) string

HashBytes is a helper for byte slices (like file content)

func (*Hasher) HashString

func (h *Hasher) HashString(s string) string

HashString is a helper for simple string hashing (like paths)

func (*Hasher) HashStruct

func (h *Hasher) HashStruct(v any) (string, error)

HashStruct generates a deterministic SHA-256 hash of a struct. It uses JSON marshaling (which sorts map keys) to ensure consistency. Important: Pass a struct that ONLY contains the "Content" fields you want to deduct on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL