public void calculateHash(PasswordHashData passwordHashData) { byte[] bytes = System.Text.Encoding.UTF8.GetBytes(passwordHashData.Password); passwordHashData.HashSha384 = getHashSha384(bytes); passwordHashData.HashSha256 = getHashSha256(bytes); passwordHashData.HashSha512 = getHashSha512(bytes); }
private void createHash(int threadID, String firstPassword, int noOfPasswords, List <PasswordHashData> processedPasswords) { var sw = Stopwatch.StartNew(); // DateTime StartDateTime = DateTime.Now; try { PasswordGenerator wg = new PasswordGenerator(firstPassword); HashCalculator hashCalculator = new HashCalculator(); // SHA1Managed crypt = new SHA1Managed(); for (int i = 0; i < noOfPasswords; i++) { PasswordHashData passwordHashData = new PasswordHashData(); passwordHashData.Password = wg.GetCurrentWord(); hashCalculator.calculateHash(passwordHashData); processedPasswords.Add(passwordHashData); wg.Next(); } } finally { //Console.WriteLine(@"Thread {0}: Time Taken in miliseconds {1}", threadID, sw.ElapsedMilliseconds); ActiveTreadCount--; } }