Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func decoder(str string) string {
key := ""
best := ""
var max float32 = 0
for i := 0x00; i < 0xFF; i++ {
key = fmt.Sprintf("%c", i)
decodedHex := xorStrToChar(str, key)
decodedAscii := hexToAscii(decodedHex)
if max < rateString(decodedAscii) {
max = rateString(decodedAscii)
best = decodedAscii
}
}
if max > 1.5 {
return best
} else {
return ""
}
}
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.