public Set2() { _ecbUtilities = new EcbUtilities(); _stringUtilities = new StringUtilities(); _hexadecimalUtilities = new HexadecimalUtilities(); }
/* * Detect single-character XOR * One of the 60-character strings in this file has been encrypted by single-character XOR. * Find it. * * (Your code from #3 should help.) * */ public string XorCipher(string[] hexadecimalStringArray) { double score = 0; double highestScore = 0; string decipheredString = String.Empty; string highestScoringString = String.Empty; StringUtilities stringScorer = new StringUtilities(); foreach (string hexadecimalString in hexadecimalStringArray) { decipheredString = XorCipher(hexadecimalString); score = stringScorer.ScoreStringByLetter(decipheredString); if (score > highestScore) { highestScore = score; highestScoringString = decipheredString; } } return highestScoringString; }