func (e *Encryption) Encrypt(data []byte) ([]byte, error) {
	length := len(data)
	outLength := length
	isFixedPadding := e.padding > 0
	if isFixedPadding {
		if length > e.padding {
			return nil, fmt.Errorf("data length longer than padding, data length %v padding %v", length, e.padding)
		}
		outLength = e.padding
	}
	out := make([]byte, outLength)
	err := e.transform(data, out)
	if err != nil {
		return nil, err
	}
	return out, nil
}
// Encrypt encrypts the data and does padding if specified
Encrypt encrypts the data and does padding if specified
// Encrypt encrypts the data and does padding if specified
func (e *Encryption) Encrypt(data []byte) ([]byte, error) {
	length := len(data)
	outLength := length
	isFixedPadding := e.padding > 0
	if isFixedPadding {
		if length > e.padding {
			return nil, fmt.Errorf("data length longer than padding, data length %v padding %v", length, e.padding)
		}
		outLength = e.padding
	}
	out := make([]byte, outLength)
	err := e.transform(data, out)
	if err != nil {
		return nil, err
	}
	return out, nil
}
func ( e * Encryption ) Encrypt ( data [ ] byte ) ( [ ] byte , error ) { length := len ( data ) outLength := length isFixedPadding := e . padding > 0 if isFixedPadding { if length > e . padding { return nil , fmt . Errorf ( " " , length , e . padding ) } outLength = e . padding } out := make ( [ ] byte , outLength ) err := e . transform ( data , out ) if err != nil { return nil , err } return out , nil }
Encrypt encrypts the data and does padding if specified
Encrypt encrypts the data and does padding if specified