多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 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。