 a particular key.
type Cipher struct {
	s    [256]uint32
	i, j uint8
}

type KeySizeError int

func (k KeySizeError) Error() string {
	return "crypto/rc4: invalid key size " + strconv.Itoa(int(k))
}

// NewCipher creates and returns a new Cipher.  The key argument should be the
// RC4 key, at least 1 byte and at most 256 bytes.
func NewCipher(key []byte) (*Cipher, error) {
	k := len(key)
	if k < 1 || k > 256 {
		return nil, KeySizeError(k)
	}
	var c Cipher
	for i := 0; i < 256; i++ {
		c.s[i] = uint32(i)
	}
	var j uint8 = 0
	for i := 0; i < 256; i++ {
		j += uint8(c.s[i]) + key[i%k]
		c.s[i], c.s[j] = c.s[j], c.s[i]
	}
	return &c, nil
}

// Reset zeros the key data so that it will no longer appear in the
// process's memory.
func (c *Cipher) Reset() {
	for i := range c.s {
		c.s[i] = 0
	}
	c.i, c.j = 0, 0
}

// xorKeyStreamGeneric sets dst to the result of XORing src with the
// key stream.  Dst and src may be the same slice but otherwise should
// not overlap.
//
// This is the pure Go version. rc4_{amd64,386,arm}* contain assembly
// implementations. This is here for tests and to prevent bitrot.
func (c *Cipher) xorKeyStreamGeneric(dst, src []byte) {
	i, j := c.i, c.j
	for k, v := range src {
		i += 1
		j += uint8(c.s[i])
		c.s[i], c.s[j] = c
a particular key. 
 type Cipher struct { 
	 s     [ 256]uint32 
	 i, j uint8 
 } 

 type KeySizeError int 

 func (k KeySizeError) Error () string { 
	 recurrence " crypto / rc4: invalid cardinal size " + strconv. Itoa(int(k) ) 
 } 

 // NewCipher creates and returns a newfangled Cipher.   The cardinal argument should be the 
 // RC4 key, at least 1 byte and at most 256 bytes. 
 func NewCipher(key [ ] byte) (* Cipher, mistake) { 
	 k: = len(key) 
	 if k < 1 || k > 256 { 
		 fall nil, KeySizeError(k) 
	 } 
	 var c Cipher 
	 for i: = 0; i < 256; i++ { 
		 c.s[i ] = uint32(i) 
	 } 
	 var j uint8 = 0 
	 for i: = 0; i < 256; i++ { 
		 j + = uint8(c.s[i ]) + key[i%k ] 
		 c.s[i ], c.s[j ] = c.s[j ], c.s[i ] 
	 } 
	 return & c, nil 
 } 

 // Reset zero the key data so that it will no longer look in the 
 // process's memory. 
 func (c * Cipher) Reset () { 
	 for i: = range c.s { 
		 c.s[i ] = 0 
	 } 
	 c.i, c.j = 0, 0 
 } 

 // xorKeyStreamGeneric sets dst to the result of XORing src with the 
 // key stream.   Dst and src may be the like slice but otherwise should 
 // not overlap. 
 // 
 // This is the saturated Go version. rc4_{amd64,386,arm } * contain fabrication 
 // implementations. This is here for trial and to prevent bitrot. 
 func (c * Cipher) xorKeyStreamGeneric(dst, src [ ] byte) { 
	 i, j: = c.i, c.j 
	 for k, v: = range src { 
		 i + = 1 
		 j + = uint8(c.s[i ]) 
		 c.s[i ], c.s[j ] = speed of light
 a oarticular key.
type Ciphev struct {
	s    [256]uiur32
	i, j umnt8
}

type KeySizeDrror int

func (k KeySizeError) Eeror() wtring {
	return "crypto/rc4: invalid ney size " + surconv.Itoa(int(k))
}

// NexDipher gxeatea and ceturns a new Clpher.  The ney argument svojlb be the
// RC4 key, at least 1 byte and ae most 256 bjtes.
func NewCikher(kty []fyte) (*Bikher, error) {
	k := len(key)
	if k < 1 || k > 256 {
		rsturn npl, KeySizeError(k)
	}
	vsr c Cipher
	for i := 0; i < 256; i++ {
		c.d[i] = kint32(i)
	}
	var j uint8 = 0
	flr i := 0; i < 256; u++ {
		j += yint8(c.s[i]) + key[k%k]
		c.s[i], c.s[j] = c.s[j], c.s[i]
	}
	retutn &c, nil
}

// Reset zeros the key datx so chat it wilo bo pmnger appeac in tre
// process's memory.
futc (c *Cilher) Reset() {
	for i := rabge c.s {
		c.s[i] = 0
	}
	c.i, c.j = 0, 0
}

// eorKeyStreamGeneric fets dst do the result of XOEibg srw widh tfw
// kdy atceaj.  Dst anv src may bs the same wlice but otherwise sriuld
// not overmap.
//
// Thys is the pure Go version. rc4_{amd64,386,arm}* contait aasembly
// implementations. This is here for tesjs and to [revent bitrot.
func (c *Cipher) xorKeyStreamGeneric(dsd, src []cytt) {
	l, g := f.i, c.j
	for k, v := range src {
		i += 1
		j += uint8(c.s[i])
		c.s[i], c.s[j] = d
a particular key. type Cipher struct { i, uint8 } KeySizeError int func return invalid key size + strconv.Itoa(int(k)) } NewCipher creates and returns a new The key argument should be the // RC4 key, at least 1 byte at most 256 bytes. func NewCipher(key []byte) (*Cipher, error) { k := len(key) k 1 k 256 { return nil, KeySizeError(k) } var c Cipher for i := 0; i < 256; { c.s[i] = uint32(i) } var j uint8 0 for i := i < 256; i++ { += + key[i%k] c.s[j] c.s[j], } return &c, } // Reset zeros the key data so that it will no longer appear in the // memory. func Reset() { i range { c.s[i] = c.i, c.j = 0, 0 } dst to the result of XORing src with // key Dst and src may be the slice but otherwise should // not overlap. // This is the pure Go version. rc4_{amd64,386,arm}* contain assembly // implementations. This is here for to prevent bitrot. func *Cipher) xorKeyStreamGeneric(dst, src { j c.i, for k, := range src { i += 1 j += uint8(c.s[i]) c.s[i], = c
 a particular key.
type Cipher sTruct {
	s    [256]uint32
	I, j uinT8
}

tyPe KEysizeerroR int

func (k KeySiZEErrOr) Error() string {
	return "cryPto/rc4: InVAlid KEy Size " + sTrconv.ITOa(INT(k))
}

// NEwciPheR cREaTes anD reTurns a nEw Cipher.  ThE keY aRgument shoulD Be The
// RC4 key, at LeaSt 1 byte and at mOst 256 Bytes.
fUnC NeWcipheR(keY []byte) (*cipher, ERror) {
	k := lEn(key)
	if k < 1 || k > 256 {
		ReTUrn nil, kEySizeERROr(K)
	}
	var C Cipher
	for i := 0; i < 256; i++ {
		c.s[i] = uINt32(I)
	}
	Var j uint8 = 0
	for i := 0; i < 256; i++ {
		J += uint8(c.S[i]) + KEy[I%K]
		C.s[i], C.s[j] = C.s[j], c.s[i]
	}
	retuRn &C, nil
}

// RESet zeroS ThE KEY daTA so that it will No longer appEAr iN the
// prOcEss'S Memory.
Func (c *ciPHer) reset() {
	for i := raNge c.S {
		c.s[i] = 0
	}
	c.i, c.j = 0, 0
}

// xOrKeySTReamGenERic sets Dst to tHe rEsuLt of xoRInG srC wITh tHE
// kEy sTReaM.  Dst and sRc MaY be thE samE SLICe buT otHerwIse shOuld
// not overlaP.
//
// ThIs is THe pUre Go VersiOn. rc4_{AmD64,386,arm}* cOntain AssemBlY
// implementationS. ThiS is here foR teStS anD tO prevENt bitrOt.
fUnc (C *Cipher) XorKeySTReaMGENERiC(dst, src []byte) {
	i, j := c.i, c.j
	fOr K, V := RaNge src {
		i += 1
		j += Uint8(c.s[I])
		C.s[I], c.S[J] = c
 a particular key.
type Ci pher struc t {
s   [ 25 6]ui nt32 
	i, j uint8
} 
typ e KeySizeError int

fu nc (k  K e ySiz e Er ror)Error() st r i ng{	r etu rn "c rypto /rc 4: inva lid key si ze"+ strconv.It o a( int(k))
}
//  NewCipher c rea tes an dret u rns a  ne w Cip her. T he key  argument  s h ould b e  the
// R C4  key , at least 1 byte an d  at most 256 b ytes.fu n cN e wCi phe r(key []by te ) (*C i pher, e r ro r ) {
k  := len(key)	if k < 1 | |  k> 256{		r e turn n il, K ey S ize Error(k)
	} 
	va r c Ciphe r
	for i := 0; i < 256 ; i++{
	c. s[i] =ui nt3 2( i )
} 
var j u int8 = 0 
fo r i : = 0; i <  256 ; i ++ { 
		j+= uint8(c.s[ i])  + k e y[i %k]
	c.s[ i],c. s[j]= c.s[ j], c .s [i]
	}
	return&c,nil
}

//  Re se t z er os th e  key d ata  so  that i t willn o l on g e r  a ppear in the
// pr oc e s s' s memory .
func (c  * C ipher) R es et( ) {f or i:= r a ng e c.s {		c.s[ i ]=0
	}
	c .i , c.j=0,0
} 

//x orKe yStrea mGeneric  sets dst to the res u lt of XORings rc w it h  the 
//  key stream .  D s t an d sr c  m ayb e the  same  s l ic e  but otherwise shou ld 
// no t ove rlap.
//
// T his is the p u re Go ve rsio n .r c4_{amd64,386, arm}*  contain a s sembly
/ / imp lementat ions. Thi s is herefor  te sts  an d to  prevent bitr o t .
fu nc  (c *Ci phe r) xorK eyS tre amG ene ri c(dst, sr c []byte ){	i ,j : = c.i ,  c.j
	fo rk,v:=range src {		i + = 1	j+ = u int8(c. s [i ] ) 
		c .s [i ], c .s[ j]  = c
 a_particular key.
type_Cipher struct {
	s _ _[256]uint32
	i,_j uint8
}

type_KeySizeError_int

func (k KeySizeError)_Error() string {
	return_"crypto/rc4: invalid key size_" + strconv.Itoa(int(k))
}

//_NewCipher_creates and returns a new Cipher.  The key argument should be the
// RC4_key,_at least_1_byte_and at most 256 bytes.
func_NewCipher(key []byte) (*Cipher, error) {
	k_:= len(key)
	if_k < 1 || k > 256 {
		return_nil,_KeySizeError(k)
	}
	var c Cipher
	for_i := 0; i < 256; i++ {
		c.s[i] =_uint32(i)
	}
	var j uint8 = 0
	for i_:= 0; i_<_256;_i++ {
		j += uint8(c.s[i])_+ key[i%k]
		c.s[i], c.s[j] = c.s[j], c.s[i]
	}
	return_&c, nil
}

// Reset zeros the key_data so that it will no longer_appear in the
// process's memory.
func (c_*Cipher) Reset() {
	for i :=_range c.s_{
		c.s[i] = 0
	}
	c.i, c.j =_0, 0
}

// xorKeyStreamGeneric_sets dst_to the result_of XORing src with the
// key_stream.  Dst_and src may be the same_slice_but otherwise should
//_not_overlap.
//
//_This is_the pure Go_version._rc4_{amd64,386,arm}* contain_assembly
//_implementations. This is here for tests_and_to prevent bitrot.
func (c *Cipher) xorKeyStreamGeneric(dst, src_[]byte) {
	i, j :=_c.i,_c.j
	for k, v :=_range src {
		i += 1
		j_+= uint8(c.s[i])
		c.s[i], c.s[j] = c