digest

package
v0.0.0-...-1f6a80c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromObjects

func FromObjects(obj ...any) digest.Digest

FromObjects returns a digest for the specified objects. SHA-256 is used as the algorithm. The objects are serialized to JSON before the digest is calculated. If an error occurs during serialization, an empty digest is returned.

func Short

func Short(d digest.Digest, length int) string

Short returns a short string representation of the digest. If the full digest is shorter than the specified length, the full digest is returned. This is useful for displaying digests in user facing outputs. As example, for a sha:256 digest, the full digest is 64 characters long, but a short digest can be 10 characters long. This will have a total of 16^10 or 2^40 possible values, which is still a large enough space to avoid collisions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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