parent
74de3d715f
commit
3f37565c5f
|
|
@ -9,7 +9,7 @@ type XOR struct {
|
|||
func (this *XOR) Decrypt(data []byte) (decrypted []byte, err error) {
|
||||
decrypted = make([]byte, len(data))
|
||||
for i := 0; i < len(data); i++ {
|
||||
decrypted[i] = data[i] ^ this.key[i%len(this.key)]
|
||||
decrypted[i] = data[len(data)-i-1] ^ this.key[i%len(this.key)]
|
||||
}
|
||||
err = nil
|
||||
return
|
||||
|
|
@ -18,7 +18,7 @@ func (this *XOR) Decrypt(data []byte) (decrypted []byte, err error) {
|
|||
func (this *XOR) Encrypt(data []byte) (encryped []byte, err error) {
|
||||
encryped = make([]byte, len(data))
|
||||
for i := 0; i < len(data); i++ {
|
||||
encryped[i] = data[i] ^ this.key[i%len(this.key)]
|
||||
encryped[i] = data[len(data)-i-1] ^ this.key[i%len(this.key)]
|
||||
}
|
||||
err = nil
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue