wust校园网web认证
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trailblazer2/app/encode/encode.go

47 lines
809 B

package encode
func XEncode(str string, key string) string {
}
func s(origin string, b bool) (result []rune) {
data := []rune(origin)
dataLen := len(origin)
resultLen := (dataLen / 4) + 1
if b {
result = make([]rune, resultLen+1)
result[resultLen] = rune(resultLen)
} else {
result = make([]rune, resultLen)
}
for i := 0; i < dataLen; i += 4 {
result[i>>2] = get(data, i, dataLen) | get(data, i+1, dataLen)<<8 | get(data, i+2, dataLen)<<16 | get(data, i+3, dataLen)<<24
}
return result
}
func l(a string, b bool) (result []rune) {
d := len(a)
data := []rune(a)
c := d - 1<<2
if b {
m := int(data[d-1])
if m < c-3 || m > c {
return nil
}
c = m
}
}
func get(str []rune, index int, length int) rune {
if index >= length {
return 0
} else {
return str[index]
}
}