package hash

import "github.com/pion/dtls/v3/pkg/crypto/hash"

Package hash provides TLS HashAlgorithm as defined in TLS 1.2

Index

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 (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

Source Files

hash.go

Version
v3.0.4 (latest)
Published
Nov 4, 2024
Platform
linux/amd64
Imports
5 packages
Last checked
1 week ago

Tools for package owners.