github.com/wfusion/gofusion@v1.1.14/common/utils/cipher/rc4_wrapper.go (about)

     1  package cipher
     2  
     3  import "crypto/rc4"
     4  
     5  type rc4Wrapper struct {
     6  	rc *rc4.Cipher
     7  }
     8  
     9  func (r *rc4Wrapper) CipherMode() Mode     { return modeStream }
    10  func (r *rc4Wrapper) PlainBlockSize() int  { return 0 }
    11  func (r *rc4Wrapper) CipherBlockSize() int { return 0 }
    12  func (r *rc4Wrapper) CryptBlocks(dst, src, buf []byte) (n int, err error) {
    13  	if len(src) == 0 {
    14  		return
    15  	}
    16  	r.rc.XORKeyStream(dst, src)
    17  	n = len(src)
    18  	return
    19  }