hashing

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package hashing provides utilities for calculating hashes.

Index

Constants

View Source
const (
	HashMd5    = "MD5"
	HashSha256 = "SHA256"
	HashSha1   = "SHA1"
	HashMurmur = "Murmur"
	HashXXHash = "xxhash" //https://github.com/OneOfOne/xxhash
)

Variables

This section is empty.

Functions

func CalculateHash

func CalculateHash(text, htype string) string

func CalculateMD5Hash

func CalculateMD5Hash(text string) string

func HasLikelyHexHashStringEntropy added in v1.17.1

func HasLikelyHexHashStringEntropy(str string) bool

HasLikelyHexHashStringEntropy states whether a string has an entropy which may entail it is a hexadecimal hash This is based on the work done by `detect-secrets` https://github.com/Yelp/detect-secrets/blob/2fc0e31f067af98d97ad0f507dac032c9506f667/detect_secrets/plugins/high_entropy_strings.py#L150

func IsLikelyHexHashString added in v1.17.1

func IsLikelyHexHashString(str string) bool

IsLikelyHexHashString determines whether the string is likely to be a hexadecimal hash or not.

Types

type IHash

type IHash interface {
	Calculate(reader io.Reader) (string, error)
	CalculateWithContext(ctx context.Context, reader io.Reader) (string, error)
	GetType() string
}

IHash defines a hashing algorithm.

func NewHashingAlgorithm

func NewHashingAlgorithm(htype string) (IHash, error)

Jump to

Keyboard shortcuts

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