fingerprint

package
v0.44.8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fingerprint

func Fingerprint(digest []byte, encoding Encoding) string

Fingerprint encodes the given digest using the encoding format. If an invalid encoding is passed, the return value will be an empty string.

func New

func New(data []byte, h crypto.Hash, encoding Encoding) (string, error)

New creates a fingerprint of the given data by hashing it and returns it in the encoding format.

Types

type Encoding

type Encoding int

Encoding defines the supported encodings for certificates and key fingerprints.

This type is the base for sshutil.FingerprintEncoding and x509util.FingerprintEncoding types.

const (
	// HexFingerprint represents the hex encoding of the fingerprint.
	//
	// This is the default encoding for an X.509 certificate.
	HexFingerprint Encoding = iota + 1
	// Base64Fingerprint represents the base64 encoding of the fingerprint.
	//
	// This is the default encoding for a public key.
	Base64Fingerprint
	// Base64URLFingerprint represents the base64URL encoding of the fingerprint.
	Base64URLFingerprint
	// Base64RawFingerprint represents the base64RawStd encoding of the
	// fingerprint.
	//
	// This is the default encoding for an SSH key and certificate.
	Base64RawFingerprint
	// Base64RawURLFingerprint represents the base64RawURL encoding of the fingerprint.
	Base64RawURLFingerprint
	// EmojiFingerprint represents the emoji encoding of the fingerprint.
	EmojiFingerprint
)

Jump to

Keyboard shortcuts

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