crypto

Imports

Imports #

"hash"
"io"
"strconv"

Constants & Variables

BLAKE2b_256 const #

const BLAKE2b_256

BLAKE2b_384 const #

const BLAKE2b_384

BLAKE2b_512 const #

const BLAKE2b_512

BLAKE2s_256 const #

const BLAKE2s_256

MD4 const #

const MD4 Hash = *ast.BinaryExpr

MD5 const #

const MD5

MD5SHA1 const #

const MD5SHA1

RIPEMD160 const #

const RIPEMD160

SHA1 const #

const SHA1

SHA224 const #

const SHA224

SHA256 const #

const SHA256

SHA384 const #

const SHA384

SHA3_224 const #

const SHA3_224

SHA3_256 const #

const SHA3_256

SHA3_384 const #

const SHA3_384

SHA3_512 const #

const SHA3_512

SHA512 const #

const SHA512

SHA512_224 const #

const SHA512_224

SHA512_256 const #

const SHA512_256

digestSizes var #

var digestSizes = []uint8{...}

hashes var #

var hashes = *ast.CallExpr

maxHash const #

const maxHash

Type Aliases

DecrypterOpts type #

type DecrypterOpts any

Hash type #

Hash identifies a cryptographic hash function that is implemented in another package.

type Hash uint

PrivateKey type #

PrivateKey represents a private key using an unspecified algorithm. Although this type is an empty interface for backwards compatibility reasons, all private key types in the standard library implement the following interface interface{ Public() crypto.PublicKey Equal(x crypto.PrivateKey) bool } as well as purpose-specific interfaces such as [Signer] and [Decrypter], which can be used for increased type safety within applications.

type PrivateKey any

PublicKey type #

PublicKey represents a public key using an unspecified algorithm. Although this type is an empty interface for backwards compatibility reasons, all public key types in the standard library implement the following interface interface{ Equal(x crypto.PublicKey) bool } which can be used for increased type safety within applications.

type PublicKey any

Interfaces

Decrypter interface #

Decrypter is an interface for an opaque private key that can be used for asymmetric decryption operations. An example would be an RSA key kept in a hardware module.

type Decrypter interface {
Public() PublicKey
Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error)
}

Signer interface #

Signer is an interface for an opaque private key that can be used for signing operations. For example, an RSA key kept in a hardware module.

type Signer interface {
Public() PublicKey
Sign(rand io.Reader, digest []byte, opts SignerOpts) (signature []byte, err error)
}

SignerOpts interface #

SignerOpts contains options for signing with a [Signer].

type SignerOpts interface {
HashFunc() Hash
}

Functions

Available method #

Available reports whether the given hash function is linked into the binary.

func (h Hash) Available() bool

HashFunc method #

HashFunc simply returns the value of h so that [Hash] implements [SignerOpts].

func (h Hash) HashFunc() Hash

New method #

New returns a new hash.Hash calculating the given hash function. New panics if the hash function is not linked into the binary.

func (h Hash) New() hash.Hash

RegisterHash function #

RegisterHash registers a function that returns a new instance of the given hash function. This is intended to be called from the init function in packages that implement hash functions.

func RegisterHash(h Hash, f func() hash.Hash)

Size method #

Size returns the length, in bytes, of a digest resulting from the given hash function. It doesn't require that the hash function in question be linked into the program.

func (h Hash) Size() int

String method #

func (h Hash) String() string

Generated with Arrow