Created
December 9, 2016 14:06
-
-
Save David-Mimnagh/1c8c46adc6e841aba6edf517fef07c75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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