hash

package
v1.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package hash provides generic utilities for computing hashes. This package contains no domain-specific types and can be used by any package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeHash

func ComputeHash(obj interface{}, collisionCount *int32) string

ComputeHash is a generic hash function following Kubernetes patterns. It computes a hash value from any object using dump.ForHash() for deterministic string representation and an optional collisionCount to avoid hash collisions. The hash will be safe encoded to avoid bad words.

This follows the same algorithm as Kubernetes controller.ComputeHash but works with any type instead of being specific to PodTemplateSpec.

Typical usage pattern from k8s.io/apimachinery/pkg/util/dump:

hashableString := dump.ForHash(myObject)
// Then pass to a hash function

func Equal

func Equal(obj1, obj2 interface{}) bool

Equal returns true if two objects produce the same hash. This is a convenience function for comparing objects without collision count.

Types

This section is empty.

Jump to

Keyboard shortcuts

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