1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-18 03:04:16 -04:00
v2fly/transport/internet/kcp/xor.go

16 lines
322 B
Go
Raw Normal View History

package kcp
// xorfwd performs XOR forwards in words, x[i] ^= x[i-4], i from 0 to len
2016-06-17 20:19:18 -04:00
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
2016-06-17 20:19:18 -04:00
func xorbkd(x []byte) {
for i := len(x) - 1; i >= 4; i-- {
x[i] ^= x[i-4]
}
}