algos

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CURVE_X25519 = "X25519"
	CURVE_25519  = "25519" // alias used in noise protocol names
	CURVE_P256   = "P256"
	CURVE_P384   = "P384"
	CURVE_P521   = "P521"
)
View Source
const (
	HASH_SHA256     = "SHA256"
	HASH_SHA512     = "SHA512"
	HASH_SHA512_256 = "SHA512/256"
	HASH_SHA3_256   = "SHA3/256"
	HASH_SHA3_512   = "SHA3/512"
	HASH_BLAKE2B    = "BLAKE2b"
	HASH_BLAKE2S    = "BLAKE2s"
)
View Source
const (
	// All package errors are wrapping Error
	Error = errorFlag("algos: error")
)

Variables

This section is empty.

Functions

func GetHash

func GetHash(name string) (crypto.Hash, error)

GetHash loads Hash implementation from the registry. It errors if no hash was registered with name.

func ListCurves

func ListCurves() []string

ListCurves returns a slice containing the names of the registered elliptic curves.

func ListHashes

func ListHashes() []string

ListHashes returns a slice containing the names of the registered Hash algorithms.

func MustRegisterCurve

func MustRegisterCurve(name string, curve ecdh.Curve)

MustRegisterCurve adds curve to the Curve registry. It panics if name is already in use or curve is invalid.

func MustRegisterHash

func MustRegisterHash(name string, hash crypto.Hash)

MustRegisterHash adds hash to the Hash registry. It panics if name is already in use or hash is invalid.

func RegisterCurve

func RegisterCurve(name string, curve ecdh.Curve) error

RegisterCurve adds curve to the Curve registry. It errors if name is already in use or curve is invalid.

func RegisterHash

func RegisterHash(name string, hash crypto.Hash) error

RegisterHash adds hash to the Hash registry. It errors if name is already in use or hash is invalid.

Types

type Curve

type Curve struct {
	ecdh.Curve
	// contains filtered or unexported fields
}

Curve embeds ecdh.Curve and adds methods that simplify usage.

func GetCurve

func GetCurve(name string) (Curve, error)

GetCurve loads Curve implementation from the registry. It errors if no curve was registered with name.

func (Curve) DHLen

func (self Curve) DHLen() int

DHLen returns byte length of Diffie-Hellmann shared secret

func (Curve) Name

func (self Curve) Name() string

Name returns Name of Curve

func (Curve) PrivateKeyLen

func (self Curve) PrivateKeyLen() int

PrivateKeyLen returns byte length of Curve PrivateKey

func (Curve) PublicKeyLen

func (self Curve) PublicKeyLen() int

PublicKeyLen returns byte length of uncompressed form of Curve PublicKey

Jump to

Keyboard shortcuts

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