Documentation
¶
Overview ¶
Package hash defines the content hash used for every object in vx.
vx identifies blobs, trees and changesets by the BLAKE3-256 hash of their canonical encoding. The text form is "b3:" followed by 64 lowercase hex characters. Objects of different kinds are hashed with a distinct domain prefix so that a blob can never collide with a tree that has the same bytes.
Index ¶
- Constants
- Variables
- type Hash
- func (h Hash) Bytes() []byte
- func (h Hash) Hex() string
- func (h Hash) IsZero() bool
- func (h Hash) MarshalText() ([]byte, error)
- func (h *Hash) Scan(src any) error
- func (h Hash) Short() string
- func (h Hash) String() string
- func (h *Hash) UnmarshalText(b []byte) error
- func (h Hash) Value() (driver.Value, error)
- type Kind
Constants ¶
const Prefix = "b3:"
Prefix is the text prefix that marks a vx hash.
const Size = 32
Size is the length of a hash in bytes.
Variables ¶
var ErrInvalid = errors.New("invalid hash")
ErrInvalid is returned when parsing malformed hash text.
Functions ¶
This section is empty.
Types ¶
type Hash ¶
Hash is a BLAKE3-256 digest. The zero value means "no object".
var Zero Hash
Zero is the empty hash.
func (Hash) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Hash) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.