public void Challenge7() { var keyStr = "YELLOW SUBMARINE"; var key = System.Text.Encoding.ASCII.GetBytes(keyStr); var data = Convert.FromBase64String(Set1Data.Challenge7Input); var decrypted = AesEcb.Decrypt(key, data); decrypted = PaddingUtil.RemovePad(decrypted); var clearText = System.Text.Encoding.ASCII.GetString(decrypted); Assert.AreEqual(Set1Data.Challenge7Solution, clearText); }
public void Challenge8() { var delim = new[] { "\n", "\r\n" }; var lines = Set1Data.Challenge8Input.Split(delim, StringSplitOptions.RemoveEmptyEntries); int index = 0; for (; index < lines.Length; index++) { var bytes = System.Text.Encoding.ASCII.GetBytes(lines[index]); if (AesEcb.IsEcbEncrypted(bytes)) { break; } } Assert.AreEqual(Set1Data.Challenge8Solution, index); }