原始问题:
用go实现cfb1模式
package cfb1
import (
"crypto/cipher"
"errors"
)
// NewCFB1 returns a stream cipher that implements CFB-1 mode. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
func NewCFB1(key []byte) (cipher.Stream, error) {
// check key length is valid for AES encryption algorithm
if len(key) != 16 && len(key) != 24 && len(key) != 32 { // not valid key length for AES encryption algorithm
return nil, errors.New("invalid key size") // return an error if invalid key length is provided
} else { // valid key length for AES encryption algorithm
// create a new instance of cfb1 struct and return it as type of cipher.Stream interface
Prev:加盟自助棋牌室的五大原因