Golang语言情怀-第57期 Go 语言标准库翻译 crypto/des

2021-03-09 11:02:52 浏览数 (1)

import "crypto/des"

des包实现了DES标准和TDEA算法,

代码语言:javascript复制
Constants
type KeySizeError
func (k KeySizeError) Error() string
func NewCipher(key []byte) (cipher.Block, error)
func NewTripleDESCipher(key []byte) (cipher.Block, error)

Constants

代码语言:javascript复制
const BlockSize = 8

DES字节块的大小。

type KeySizeError

代码语言:javascript复制
type KeySizeError int
func (KeySizeError) Error
代码语言:javascript复制
func (k KeySizeError) Error() string

func NewCipher

代码语言:javascript复制
func NewCipher(key []byte) (cipher.Block, error)

创建并返回一个使用DES算法的cipher.Block接口。

func NewTripleDESCipher

代码语言:javascript复制
func NewTripleDESCipher(key []byte) (cipher.Block, error)

创建并返回一个使用TDEA算法的cipher.Block接口。

英文如下:

Package des

  • import "crypto/des"
  • Overview
  • Index
  • Examples

Overview ▾

Package des implements the Data Encryption Standard (DES) and the Triple Data Encryption Algorithm (TDEA) as defined in U.S. Federal Information Processing Standards Publication 46-3.

DES is cryptographically broken and should not be used for secure applications.

Index ▾

  • Constants
  • func NewCipher(key []byte) (cipher.Block, error)
  • func NewTripleDESCipher(key []byte) (cipher.Block, error)
  • type KeySizeError
  • func (k KeySizeError) Error() string

Examples

(Expand All)

  • NewTripleDESCipher

Package files

block.go cipher.go const.go

Constants

The DES block size in bytes.

代码语言:javascript复制
const BlockSize = 8

func NewCipher

代码语言:javascript复制
func NewCipher(key []byte) (cipher.Block, error)

NewCipher creates and returns a new cipher.Block.

func NewTripleDESCipher

代码语言:javascript复制
func NewTripleDESCipher(key []byte) (cipher.Block, error)

NewTripleDESCipher creates and returns a new cipher.Block.

▹ Example

type KeySizeError

代码语言:javascript复制
type KeySizeError int

func (KeySizeError) Error

代码语言:javascript复制
func (k KeySizeError) Error() string


参考资料:

Go语言中文文档

http://www.golang.ltd/

Go语言官方文档

https://golang.google.cn/

0 人点赞