🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 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。