hash

package
v6.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package hash provides a way for managing the underlying hash implementations used across go-git.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedHashFunction = errors.New("unsupported hash function")

ErrUnsupportedHashFunction is returned when an unsupported hash function is used.

Functions

func FromObjectFormat

func FromObjectFormat(f format.ObjectFormat) (hash.Hash, error)

FromObjectFormat returns the correct Hash to be used based on the ObjectFormat being used. If the ObjectFormat is not recognised, returns ErrInvalidObjectFormat.

func RegisterHash

func RegisterHash(h crypto.Hash, f func() hash.Hash) error

RegisterHash allows for the hash algorithm used to be overridden. This ensures the hash selection for go-git must be explicit, when overriding the default value.

Types

type Hash

type Hash interface {
	hash.Hash
}

Hash is the same as hash.Hash. This allows consumers to not having to import this package alongside "hash".

func New

func New(h crypto.Hash) Hash

New returns a new Hash for the given hash function. It panics if the hash function is not registered.

Jump to

Keyboard shortcuts

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