Esempio n. 1
0
 private void stopUnhash_Click(object sender, EventArgs e)
 {
     if (this.unhasher32 != null)
     {
         this.unhasher32.Stop();
         this.unhasher32 = null;
     }
     if (this.unhasher64 != null)
     {
         this.unhasher64.Stop();
         this.unhasher64 = null;
     }
 }
Esempio n. 2
0
 protected override void OnClosing(CancelEventArgs e)
 {
     if (this.unhasher32 != null)
     {
         this.unhasher32.Stop();
         this.unhasher32 = null;
     }
     if (this.unhasher64 != null)
     {
         this.unhasher64.Stop();
         this.unhasher64 = null;
     }
     base.OnClosing(e);
 }
Esempio n. 3
0
        private void unhash_Click(object sender, EventArgs e)
        {
            string unhashCmbStr = unhashCmb.SelectedItem as string;

            if (this.unhasher32 != null && !this.unhasher32.Finished)
            {
                return;
            }
            if (this.unhasher64 != null && !this.unhasher64.Finished)
            {
                return;
            }
            if (unhashCmbStr == null)
            {
                MessageBox.Show("No Unhashing Algorithm selected", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (unhashCmbStr.Equals(kFNV32) || unhashCmbStr.Equals(kXor32))
            {
                if (this.unhasher64 != null)
                {
                    this.unhasher64.Stop();
                    this.unhasher64 = null;
                }
                if (this.unhasher32 == null || this.unhasher32.Finished)
                {
                    uint   hash;
                    string input = this.inputTxt.Text;
                    if (input.StartsWith("0x"))
                    {
                        input = input.Substring(2);
                    }
                    else if (input.StartsWith("0X"))
                    {
                        input = input.Substring(2);
                    }
                    if (uint.TryParse(input, System.Globalization.NumberStyles.HexNumber,
                                      System.Globalization.CultureInfo.CurrentCulture, out hash))
                    {
                        bool xorFold = !unhashCmbStr.Equals(kFNV32);
                        if (xorFold && (hash & filter32) > 0xffffffU)
                        {
                            MessageBox.Show("Xor 32 will never find matches for 0x" + (hash & filter32).ToString("X8")
                                            + ".\nIt is greater than 24 bits in length.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            this.resultsLST.Items.Add("Unhash results for 0x" + hash.ToString("X8"));
                            int maxChars   = (int)this.maxCharsNUM.Value;
                            int maxMatches = (int)this.maxMatchesNUM.Value;
                            this.unhasher32      = new FNVUnhasher32(hash, this.searchTable, maxChars, maxMatches, xorFold, filter32);
                            this.prevResultCount = 0;
                            this.unhasher32.Start();
                            this.updateTimer.Start();
                        }
                    }
                }
            }
            else if (unhashCmbStr.Equals(kFNV64) || unhashCmbStr.Equals(kXor64))
            {
                if (this.unhasher32 != null)
                {
                    this.unhasher32.Stop();
                    this.unhasher32 = null;
                }
                if (this.unhasher64 == null || this.unhasher64.Finished)
                {
                    ulong  hash;
                    string input = this.inputTxt.Text;
                    if (input.StartsWith("0x"))
                    {
                        input = input.Substring(2);
                    }
                    else if (input.StartsWith("0X"))
                    {
                        input = input.Substring(2);
                    }
                    if (ulong.TryParse(input, System.Globalization.NumberStyles.HexNumber,
                                       System.Globalization.CultureInfo.CurrentCulture, out hash))
                    {
                        bool xorFold = !unhashCmbStr.Equals(kFNV64);
                        if (xorFold && (hash & filter64) > 0xffffffffffffUL)
                        {
                            MessageBox.Show("Xor 64 will never find matches for 0x" + (hash & filter64).ToString("X16")
                                            + ".\nIt is greater than 48 bits in length.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            this.resultsLST.Items.Add("Unhash results for 0x" + hash.ToString("X16"));
                            int maxChars   = (int)this.maxCharsNUM.Value;
                            int maxMatches = (int)this.maxMatchesNUM.Value;
                            this.unhasher64      = new FNVUnhasher64(hash, this.searchTable, maxChars, maxMatches, xorFold, filter64);
                            this.prevResultCount = 0;
                            this.unhasher64.Start();
                            this.updateTimer.Start();
                        }
                    }
                }
            }
        }