Xray-core/transport/internet/kcp/xor.go

19 lines
358 B
Go
Raw Normal View History

2021-09-20 13:00:55 +00:00
//go:build !amd64
2020-11-25 11:01:53 +00:00
// +build !amd64
package kcp
// xorfwd performs XOR forwards in words, x[i] ^= x[i-4], i from 0 to len
func xorfwd(x []byte) {
for i := 4; i < len(x); i++ {
x[i] ^= x[i-4]
}
}
// xorbkd performs XOR backwords in words, x[i] ^= x[i-4], i from len to 0
func xorbkd(x []byte) {
for i := len(x) - 1; i >= 4; i-- {
x[i] ^= x[i-4]
}
}