|
|
@ -17,26 +17,18 @@ |
|
|
|
public static void Main() |
|
|
|
public static void Main() |
|
|
|
{ |
|
|
|
{ |
|
|
|
var processor = new Processor("poultry outwits ants", 3); |
|
|
|
var processor = new Processor("poultry outwits ants", 3); |
|
|
|
var results = new List<string>(); |
|
|
|
|
|
|
|
foreach (var phrase in processor.GeneratePhrases(ReadInput())) |
|
|
|
foreach (var phrase in processor.GeneratePhrases(ReadInput())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var hash = GetMd5Hash(phrase); |
|
|
|
var hash = GetHash(phrase); |
|
|
|
Console.WriteLine(GetMd5Hash(phrase) + ": " + phrase); |
|
|
|
Console.WriteLine(hash + ": " + phrase); |
|
|
|
results.Add(phrase + ": " + hash); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var result in results.OrderBy(line => line)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Console.WriteLine(result); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static string GetMd5Hash(string input) |
|
|
|
private static string GetHash(string input) |
|
|
|
{ |
|
|
|
{ |
|
|
|
using (MD5 md5Hash = MD5.Create()) |
|
|
|
using (MD5 hasher = MD5.Create()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Convert the input string to a byte array and compute the hash. |
|
|
|
var data = hasher.ComputeHash(Encoding.UTF8.GetBytes(input)); |
|
|
|
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input)); |
|
|
|
|
|
|
|
return string.Concat(data.Select(b => b.ToString("x2"))); |
|
|
|
return string.Concat(data.Select(b => b.ToString("x2"))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|