public async void Find_Password(string hash, TypeHashAlgoritm type)
        {
            isStopped = false;
            byte[]       arr          = Encoding.UTF8.GetBytes(hash);
            SearcherPass searcherPass = new SearcherPass();
            Hasher       hasher       = new Hasher(type);

            while (!isStopped)
            {
                MD5    mD5         = new MD5CryptoServiceProvider();
                byte[] arrFromText = searcherPass.GetByteArray();

                byte []       computeHash = hasher.ComputeHash(arrFromText);
                StringBuilder result      = new StringBuilder();
                foreach (var b in computeHash)
                {
                    result.Append(b.ToString("x2"));
                }

                if (hash == result.ToString())
                {
                    string tempPas = searcherPass.GetString();
                    this.passArray.Add(new FindedPassword(tempPas));
                    this.addToArrayPass();
                    await Task.CompletedTask;
                    break;
                }
                searcherPass.IncrementByteArray();
            }
        }
Esempio n. 2
0
        public Hasher(TypeHashAlgoritm type)
        {
            this.typeHashFunction = type;

            switch (type)
            {
            case TypeHashAlgoritm.MD5: this.mD5 = new MD5CryptoServiceProvider(); break;

            case TypeHashAlgoritm.SHA256: this.hA256 = new SHA256CryptoServiceProvider(); break;

            case TypeHashAlgoritm.SHA512: this.hA512 = new SHA512CryptoServiceProvider(); break;

            default: break;
            }
        }
        public async void FindPassword(string hash, TypeHashAlgoritm typeHashAlgoritm)
        {
            await Task.CompletedTask;

            switch (typeHashAlgoritm)
            {
            case TypeHashAlgoritm.MD5: Find_Password(hash, TypeHashAlgoritm.MD5);  break;

            case TypeHashAlgoritm.SHA256: Find_Password(hash, TypeHashAlgoritm.SHA256); break;

            case TypeHashAlgoritm.SHA512: Find_Password(hash, TypeHashAlgoritm.SHA512); break;

            default: break;
            }
        }