ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# package aes `import "crypto/aes"` aes包实现了AES加密算法,参见U.S. Federal Information Processing Standards Publication 197。 ## Index * [Constants](#pkg-constants) * [type KeySizeError](#KeySizeError) * [func (k KeySizeError) Error() string](#KeySizeError.Error) * [func NewCipher(key []byte) (cipher.Block, error)](#NewCipher) ## Constants ``` const BlockSize = 16 ``` AES字节块大小。 ## type [KeySizeError](https://github.com/golang/go/blob/master/src/crypto/aes/cipher.go#L21 "View Source") ``` type KeySizeError int ``` ### func (KeySizeError) [Error](https://github.com/golang/go/blob/master/src/crypto/aes/cipher.go#L23 "View Source") ``` func (k KeySizeError) Error() string ``` ## func [NewCipher](https://github.com/golang/go/blob/master/src/crypto/aes/cipher.go#L31 "View Source") ``` func NewCipher(key []byte) (cipher.Block, error) ``` 创建一个cipher.Block接口。参数key为密钥,长度只能是16、24、32字节,用以选择AES-128、AES-192、AES-256。