hash

package
v3.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 5 Imported by: 4

Documentation

Overview

Package hash provides TLS HashAlgorithm as defined in TLS 1.2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Algorithms

func Algorithms() map[Algorithm]struct{}

Algorithms returns all the supported Hash Algorithms.

Types

type Algorithm

type Algorithm uint16

Algorithm is used to indicate the hash algorithm used https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-18

const (
	None    Algorithm = 0 // Blacklisted
	MD5     Algorithm = 1 // Blacklisted
	SHA1    Algorithm = 2 // Blacklisted
	SHA224  Algorithm = 3
	SHA256  Algorithm = 4
	SHA384  Algorithm = 5
	SHA512  Algorithm = 6
	Ed25519 Algorithm = 8
)

Supported hash algorithms.

func ExtractHashFromPSS added in v3.1.0

func ExtractHashFromPSS(pssScheme uint16) Algorithm

ExtractHashFromPSS extracts the hash algorithm from an RSA-PSS SignatureScheme value. This handles TLS 1.3 PSS schemes. Returns None if the scheme is not a recognized PSS scheme.

func (Algorithm) CryptoHash

func (a Algorithm) CryptoHash() crypto.Hash

CryptoHash returns the crypto.Hash implementation for the given HashAlgorithm.

func (Algorithm) Digest

func (a Algorithm) Digest(b []byte) []byte

Digest performs a digest on the passed value.

func (Algorithm) Insecure

func (a Algorithm) Insecure() bool

Insecure returns if the given HashAlgorithm is considered secure in DTLS 1.2 .

func (Algorithm) String

func (a Algorithm) String() string

String makes hashAlgorithm printable.

Jump to

Keyboard shortcuts

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