github.com/TeaOSLab/EdgeNode@v1.3.8/internal/encrypt/method_raw.go (about)

     1  package encrypt
     2  
     3  type RawMethod struct {
     4  }
     5  
     6  func (this *RawMethod) Init(key, iv []byte) error {
     7  	return nil
     8  }
     9  
    10  func (this *RawMethod) Encrypt(src []byte) (dst []byte, err error) {
    11  	if len(src) == 0 {
    12  		return
    13  	}
    14  	dst = make([]byte, len(src))
    15  	copy(dst, src)
    16  	return
    17  }
    18  
    19  func (this *RawMethod) Decrypt(dst []byte) (src []byte, err error) {
    20  	if len(dst) == 0 {
    21  		return
    22  	}
    23  	src = make([]byte, len(dst))
    24  	copy(src, dst)
    25  	return
    26  }