Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func repeatingXorMakeKey(key string, length int) string {
ret := strings.Repeat(key, length/len(key)+1)
return ret[0:length]
}
func repeatingKeyXor(clear string, key string) string {
entryTab := strings.Split(clear, "\n")
output := ""
for i := 0; i < len(entryTab); i++ {
repeatedKey := repeatingXorMakeKey(key, len(entryTab[i]))
hexkey := fmt.Sprintf("%x", repeatedKey)
hexclear := fmt.Sprintf("%x", entryTab[i])
output += xor_equal_len(hexkey, hexclear)
output += "\n"
}
return output
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.