Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("anna md5 tiiviste: ");
- string salasana = Console.ReadLine();
- string tulos = "";
- string merkit = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- string tiiviste = "";
- bool onnistui = false;
- if (salasana.Length == 32)
- {
- int purkuaika = 0;
- while(purkuaika <= 1)
- {
- purkuaika++;
- Console.WriteLine("purkamisen aloitus: " + DateTime.Now);
- break;
- }
- foreach (char ch1 in merkit)
- {
- tulos = "" + ch1;
- byte[] vou = new UTF8Encoding().GetBytes(tulos);
- byte[] kek = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(vou);
- tiiviste = BitConverter.ToString(kek).Replace("-", string.Empty).ToLower();
- if (tiiviste == salasana)
- {
- onnistui = true;
- goto Lopetus;
- }
- foreach (char ch2 in merkit)
- {
- tulos = "" + ch1 + ch2;
- byte[] vou2 = new UTF8Encoding().GetBytes(tulos);
- byte[] kek2 = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(vou2);
- tiiviste = BitConverter.ToString(kek2).Replace("-", string.Empty).ToLower();
- if (tiiviste == salasana)
- {
- onnistui = true;
- goto Lopetus;
- }
- foreach (char ch3 in merkit)
- {
- tulos = "" + ch1 + ch2 + ch3;
- byte[] vou3 = new UTF8Encoding().GetBytes(tulos);
- byte[] kek3 = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(vou3);
- tiiviste = BitConverter.ToString(kek3).Replace("-", string.Empty).ToLower();
- if (tiiviste == salasana)
- {
- onnistui = true;
- goto Lopetus;
- }
- foreach (char ch4 in merkit)
- {
- tulos = "" + ch1 + ch2 + ch3 + ch4;
- byte[] on = new UTF8Encoding().GetBytes(tulos);
- byte[] vou4 = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(on);
- tiiviste = BitConverter.ToString(vou2).Replace("-", string.Empty).ToLower();
- if (tiiviste == salasana)
- {
- onnistui = true;
- goto Lopetus;
- }
- foreach (char ch5 in merkit)
- {
- tulos = "" + ch1 + ch2 + ch3 + ch4 + ch5;
- byte[] vou5 = new UTF8Encoding().GetBytes(tulos);
- byte[] kek5 = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(vou5);
- tiiviste = BitConverter.ToString(kek5).Replace("-", string.Empty).ToLower();
- if (tiiviste == salasana)
- {
- onnistui = true;
- goto Lopetus;
- }
- else if (tulos == "zzzz")
- {
- }
- }
- }
- }
- }
- }
- }
- Lopetus:
- if (tulos != "" && onnistui)
- Console.Write("salasana on: " + tulos + " ");
- else if (tulos != "")
- Console.WriteLine("salasanaa ei onnistuttu murtamaan");
- else
- Console.Write("et antanu oikeanlaista md5 tiivistettä");
- goto end;
- end:
- Console.WriteLine("purkamisen lopetus: " + DateTime.Now);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement