implement
func strByXOR(message string,keywords string) string{
messageLen := len(message)
keywordsLen := len(keywords)
result := ""
for i := 0; i < messageLen; i++ {
result += string(message[i] ^ keywords[i%keywordsLen])
}
return result
}
useage
var message = "hello world"
var key = "2333"
fmt.Println("encode start")
var encodeStr = strByXOR(message,key)
fmt.Println(encodeStr)
var decodeStr = strByXOR(encodeStr,key)
fmt.Println(decodeStr)