public void TestMethod_Sha512_One_Letter_a() { string source = "a"; string expected = "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75"; string result = FunctionsCrypto.Sha512(source); Assert.AreEqual(result, expected); }
public void TestMethod_Sha256_One_Letter_a() { string source = "a"; string expected = "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"; string result = FunctionsCrypto.Sha256(source); Assert.AreEqual(result, expected); }
public void TestMethod_Sha512_One_Word() { string source = "azerty"; string expected = "df6b9fb15cfdbb7527be5a8a6e39f39e572c8ddb943fbc79a943438e9d3d85ebfc2ccf9e0eccd9346026c0b6876e0e01556fe56f135582c05fbdbb505d46755a"; string result = FunctionsCrypto.Sha512(source); Assert.AreEqual(result, expected); }
public void TestMethod_ComputeHashSha1() { string source0 = "azerty"; byte[] source = Encoding.ASCII.GetBytes(source0); byte[] expected = new byte[] { 156, 249, 93, 172, 210, 38, 220, 244, 61, 163, 118, 205, 182, 203, 186, 112, 53, 33, 137, 33 }; byte[] result = FunctionsCrypto.ComputeHashSha1(source); Assert.AreEqual(result, expected); }
static void Main() { Action <string> display = Console.WriteLine; ulong count = 0; bool addToListe = true; bool saveToFile = false; bool saveToDatabase = true; ulong numberOfItem = 1000000; ulong fileCount = 1; Dictionary <string, string> dicoResult = new Dictionary <string, string>(); // IdNtlm Code NtlmHash // 1 A C5DD1C2BC8719C01B25B4EB2692C9FEE string alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&é'(-è_çà)=$£*%âêîôûù,;:!?./\\§µä+°€@<>"; for (int i = 0; i < alphabet.Length; i++) { count++; string ntlm = FunctionsCrypto.Ntlm(alphabet[i].ToString()); display($"{alphabet[i]} = {ntlm}"); if (addToListe) { dicoResult.Add(alphabet[i].ToString(), ntlm); } } // 100 NTLM calculated so far with 1 character for (int i = 0; i < alphabet.Length; i++) { for (int j = 0; j < alphabet.Length; j++) { if (saveToDatabase && count % numberOfItem == 0) { RecordResultsToDatabase(dicoResult); dicoResult.Clear(); count = 0; } if (saveToFile && count % numberOfItem == 0) { ulong fileNumber = fileCount * numberOfItem; RecordResultsToFile(dicoResult, fileNumber); fileCount++; dicoResult.Clear(); } count++; string ntlm = FunctionsCrypto.Ntlm($"{alphabet[i]}{alphabet[j]}"); display($"{alphabet[i]}{alphabet[j]} = {ntlm}"); if (addToListe) { dicoResult.Add($"{alphabet[i]}{alphabet[j]}", ntlm); } } } //// 10 302 NTLM calculated so far with 2 characters for (int i = 0; i < alphabet.Length; i++) { for (int j = 0; j < alphabet.Length; j++) { for (int k = 0; k < alphabet.Length; k++) { if (saveToDatabase && count % numberOfItem == 0) { RecordResultsToDatabase(dicoResult); dicoResult.Clear(); count = 0; } if (saveToFile && count % numberOfItem == 0) { ulong fileNumber = fileCount * numberOfItem; RecordResultsToFile(dicoResult, fileNumber); fileCount++; dicoResult.Clear(); } count++; string ntlm = FunctionsCrypto.Ntlm(alphabet[i].ToString() + alphabet[j].ToString() + alphabet[k].ToString()); display($"{alphabet[i]}{alphabet[j]}{alphabet[k]} = {ntlm}"); if (addToListe) { dicoResult.Add($"{alphabet[i]}{alphabet[j]}{alphabet[k]}", ntlm); } } } } //// 1 040 603 NTLM calculated so far with 3 characters for (int i = 0; i < alphabet.Length; i++) { for (int j = 0; j < alphabet.Length; j++) { for (int k = 0; k < alphabet.Length; k++) { for (int l = 0; l < alphabet.Length; l++) { if (saveToDatabase && count % numberOfItem == 0) { RecordResultsToDatabase(dicoResult); dicoResult.Clear(); count = 0; } if (saveToFile && count % numberOfItem == 0) { ulong fileNumber = fileCount * numberOfItem; RecordResultsToFile(dicoResult, fileNumber); fileCount++; dicoResult.Clear(); } count++; string ntlm = FunctionsCrypto.Ntlm(alphabet[i].ToString() + alphabet[j].ToString() + alphabet[k].ToString() + alphabet[l].ToString()); display($"{alphabet[i]}{alphabet[j]}{alphabet[k]}{alphabet[l]} = {ntlm}"); if (addToListe) { dicoResult.Add($"{alphabet[i]}{alphabet[j]}{alphabet[k]}{alphabet[l]}", ntlm); } } } } } // 105 101 004 NTLM calculated so far with 4 characters //out of memory error at 3.6 GB console app if addToListe = true for (int i = 0; i < alphabet.Length; i++) { for (int j = 0; j < alphabet.Length; j++) { for (int k = 0; k < alphabet.Length; k++) { for (int l = 0; l < alphabet.Length; l++) { for (int m = 0; m < alphabet.Length; m++) { if (saveToDatabase && count % numberOfItem == 0) { RecordResultsToDatabase(dicoResult); dicoResult.Clear(); count = 0; } if (saveToFile && count % numberOfItem == 0) { ulong fileNumber = fileCount * numberOfItem; RecordResultsToFile(dicoResult, fileNumber); fileCount++; dicoResult.Clear(); } count++; string ntlm = FunctionsCrypto.Ntlm(alphabet[i].ToString() + alphabet[j].ToString() + alphabet[k].ToString() + alphabet[l].ToString() + alphabet[m].ToString()); display($"{alphabet[i]}{alphabet[j]}{alphabet[k]}{alphabet[l]}{alphabet[m]} = {ntlm}"); if (addToListe) { dicoResult.Add($"{alphabet[i]}{alphabet[j]}{alphabet[k]}{alphabet[l]}{alphabet[m]}", ntlm); } } } } } } // ? NTLM calculated so far with 5 characters display(string.Empty); display($"There are {count} NTLM hash calculated."); display(string.Empty); display("Press any key to exit:"); Console.ReadKey(); }