//Attempts to detect if a ciphertext was encrypted using single character xor
func SingleByteXorScore(bytestring []byte) bool {
	var maxScore float64
	bytes := xor.AllBytes()
	for _, b := range bytes {
		pt := xor.SingleCharXor(b, bytestring)
		if score := PlaintextScore(pt); score > maxScore {
			maxScore = score
		}
	}

	//This value is optimized for challenge 4. Can be changed if necessary
	if maxScore >= .90 {
		return true
	} else {
		return false
	}
}
func BreakSingleCharXor(ciphertext []byte) (plaintext []byte, key byte) {
	bytes := xor.AllBytes()
	var maxScore float64 = 0.0

	for _, b := range bytes {
		var potential_plaintext []byte = make([]byte, len(ciphertext))
		for i, c := range ciphertext {
			potential_plaintext[i] = c ^ b
		}
		score := PlaintextScore(potential_plaintext)
		if score > maxScore {
			maxScore = score
			plaintext = potential_plaintext
			key = b
		}
	}
	return
}