Skip to content

Instantly share code, notes, and snippets.

@David-Mimnagh
Created December 9, 2016 14:06
Show Gist options
  • Save David-Mimnagh/1c8c46adc6e841aba6edf517fef07c75 to your computer and use it in GitHub Desktop.
Save David-Mimnagh/1c8c46adc6e841aba6edf517fef07c75 to your computer and use it in GitHub Desktop.
byte[] data = null;
List<byte[]> dataList = new List<byte[]>();
string inputCopy = input;
// Convert the input string to a byte array and compute the hash.
do
{
Console.WriteLine("The index " + index+ ".");
inputCopy = input;
inputCopy += index.ToString();
data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(inputCopy));
if(data[1] == 0)
{
if (data[1] == 0)
{
if (data[2] == 0)
{
if (data[3] == 0)
{
if (data[4] == 0)
{
dataList.Add(data);
}
}
}
}
}
index++;
} while (dataList.Count < 8);
// Create a new Stringbuilder to collect the bytes
// and create a string.
StringBuilder sBuilder = new StringBuilder();
// Loop through each byte of the hashed data
// and format each one as a hexadecimal string.
sBuilder.Append(data[5].ToString("x2"));
// Return the hexadecimal string.
return sBuilder.ToString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment