crypto
3 分钟阅读
Package crypto collects common cryptographic constants.
crypto 包收集常见的加密常量。
常量
This section is empty.
变量
This section is empty.
函数
func RegisterHash
| |
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.
RegisterHash 注册一个函数,该函数返回给定哈希函数的新实例。这旨在从实现哈希函数的包中的 init 函数中调用。
类型
type Decrypter <- go1.5
| |
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.
Decrypter 是一个不透明私钥的接口,可用于非对称解密操作。一个示例是保存在硬件模块中的 RSA 密钥。
type DecrypterOpts <- go1.5
| |
type Hash
| |
Hash identifies a cryptographic hash function that is implemented in another package.
Hash 标识在另一个包中实现的加密哈希函数。
| |
(Hash) Available
| |
Available reports whether the given hash function is linked into the binary.
Available 报告给定的哈希函数是否链接到二进制文件中。
(Hash) HashFunc <- go1.4
| |
HashFunc simply returns the value of h so that Hash implements SignerOpts.
HashFunc 仅返回 h 的值,以便 Hash 实现 SignerOpts。
(Hash) New
| |
New returns a new hash.Hash calculating the given hash function. New panics if the hash function is not linked into the binary.
New 返回一个新的 hash.Hash,用于计算给定的哈希函数。如果哈希函数未链接到二进制文件中,New 会引发 panic。
(Hash) Size
| |
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.
Size 返回由给定哈希函数产生的摘要的长度(以字节为单位)。它不要求将有问题的哈希函数链接到程序中。
(Hash) String <- go1.15
| |
type PrivateKey
| |
PrivateKey represents a private key using an unspecified algorithm.
PrivateKey 使用未指定的算法表示私钥。
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.
以及特定于用途的接口,例如 Signer 和 Decrypter,可用于提高应用程序中的类型安全性。
type PublicKey <- go1.2
| |
PublicKey represents a public key using an unspecified algorithm.
PublicKey 使用未指定的算法表示公钥。
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 Signer <- go1.4
| |
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.
Signer 是一个不透明私钥的接口,可用于签名操作。例如,保存在硬件模块中的 RSA 密钥。
type SignerOpts <- go1.4
| |
SignerOpts contains options for signing with a Signer.
SignerOpts 包含使用 Signer 进行签名的选项。