Files
youtube-downloader/downloader/vendor/github.com/kkdai/youtube/v2/decipher_operations.go

28 lines
450 B
Go

package youtube
type DecipherOperation func([]byte) []byte
func newSpliceFunc(pos int) DecipherOperation {
return func(bs []byte) []byte {
return bs[pos:]
}
}
func newSwapFunc(arg int) DecipherOperation {
return func(bs []byte) []byte {
pos := arg % len(bs)
bs[0], bs[pos] = bs[pos], bs[0]
return bs
}
}
func reverseFunc(bs []byte) []byte {
l, r := 0, len(bs)-1
for l < r {
bs[l], bs[r] = bs[r], bs[l]
l++
r--
}
return bs
}