示例#1
0
        private int RunAgainstKats()
        {
            const string SrcFile = BASEWORKINGDIR + @"ParsedKats\MASTER.txt";

            string[]          SrcLines = System.IO.File.ReadAllLines(SrcFile);
            Skein.Skein256Ex  my256    = new Skein.Skein256Ex();
            Skein.Skein512Ex  my512    = new Skein.Skein512Ex();
            Skein.Skein1024Ex my1k     = new Skein.Skein1024Ex();
            int completedTests         = 0;

            foreach (string Thing in SrcLines)
            {
                try
                {
                    txtOutput1.AppendText(Thing + "\r\n");
                    string[] ThingParts = Thing.Split('^');
                    byte[]   DataToUse  = null;
                    UInt16   HashBitLen;
                    int      MACInputLen;
                    byte[]   MACToUse = null;
                    //'Dim TempByteCount As Integer
                    byte treeNode;
                    byte treeLeaf;
                    byte treeMaxLevels;

                    if (!ThingParts[0].ToLower().Contains("tree"))
                    {
                        txtOutput2.AppendText("Skip KNOWN PASS test:" + Thing.Substring(0, 60) + "\r\n");
                        continue;
                    }

                    int InputLen = int.Parse(ThingParts[3].Replace("L", String.Empty));

                    if (ThingParts.Length == 8)
                    {
                        treeLeaf      = byte.Parse(ThingParts[4].Replace("LF", string.Empty), System.Globalization.NumberStyles.HexNumber);
                        treeNode      = byte.Parse(ThingParts[5].Replace("ND", string.Empty), System.Globalization.NumberStyles.HexNumber);
                        treeMaxLevels = byte.Parse(ThingParts[6].Replace("ML", string.Empty), System.Globalization.NumberStyles.HexNumber);
                    }
                    else
                    {
                        treeLeaf      = 0;
                        treeNode      = 0;
                        treeMaxLevels = 0;
                    }

                    //create sub-arrays of data, otherwise Skein functions will use ENTIRE array
                    if (ThingParts.Length == 6)
                    {
                        MACInputLen = int.Parse(ThingParts[4].Replace("MAC", String.Empty));
                        MACToUse    = new byte[MACInputLen];
                        Buffer.BlockCopy(MACKey, 0, MACToUse, 0, MACInputLen);
                    }
                    else
                    {
                        MACToUse = null;
                    }

                    if (InputLen == 0)
                    {
                        DataToUse = null;
                    }
                    else
                    {
                        int numBytes;
                        int numExtraBits;
                        numBytes = Math.DivRem(InputLen, 8, out numExtraBits);
                        if (numExtraBits > 0)
                        {
                            DataToUse = new byte[numBytes + 1];
                        }
                        else
                        {
                            DataToUse = new byte[numBytes];
                        }
                        System.Diagnostics.Debug.Print("INPUTLEN: " + InputLen.ToString() + " DATATOUSE.LENGTH: " + DataToUse.Length.ToString());
                        switch (ThingParts[0].ToLower())
                        {
                        case "incrementing":
                            Buffer.BlockCopy(IncrementingDataSrc, 0, DataToUse, 0, DataToUse.Length);
                            break;

                        case "random":
                            Buffer.BlockCopy(RandomDataSrc, 0, DataToUse, 0, DataToUse.Length);
                            break;

                        case "zero":
                            Buffer.BlockCopy(ZeroDataSrc, 0, DataToUse, 0, DataToUse.Length);
                            break;

                        case "random_mac":
                            Buffer.BlockCopy(RandomMACDataSrc, 0, DataToUse, 0, DataToUse.Length);
                            break;

                        case "tree":
                            switch (ThingParts[1].ToLower())
                            {
                            case "s256": Buffer.BlockCopy(TreeDataSrc256, 0, DataToUse, 0, DataToUse.Length); break;

                            case "s512": Buffer.BlockCopy(TreeDataSrc512, 0, DataToUse, 0, DataToUse.Length); break;

                            case "s1024": Buffer.BlockCopy(TreeDataSrc1k, 0, DataToUse, 0, DataToUse.Length); break;
                            }
                            break;

                        default:
                            txtOutput2.AppendText("Skip UNKNOWN test:" + Thing.Substring(0, 60) + "\r\n");
                            continue;
                        }
                    }
                    HashBitLen = UInt16.Parse(ThingParts[2].Replace("H", String.Empty));
                    byte[] Result = null;

                    try
                    {
                        switch (ThingParts[1].ToLower())
                        {
                        case "s256":
                            if (Thing.ToLower().Contains("mac") && MACToUse != null)
                            {
                                my256.Initialize(HashBitLen, MACToUse, null, 0, 0, 0);
                                Result = my256.ComputeHash(DataToUse, (byte)(InputLen % 8));
                            }
                            else
                            {
                                my256.Initialize(HashBitLen, null, null, treeLeaf, treeNode, treeMaxLevels);
                                Result = my256.ComputeHash(DataToUse, (byte)(InputLen % 8));
                            }
                            break;

                        case "s512":
                            if (Thing.ToLower().Contains("mac") && MACToUse != null)
                            {
                                my512.Initialize(HashBitLen, MACToUse, null, 0, 0, 0);
                                Result = my512.ComputeHash(DataToUse, (byte)(InputLen % 8));
                            }
                            else
                            {
                                my512.Initialize(HashBitLen, null, null, treeLeaf, treeNode, treeMaxLevels);
                                Result = my512.ComputeHash(DataToUse, (byte)(InputLen % 8));
                            }
                            break;

                        case "s1024":
                            if (Thing.ToLower().Contains("mac") && MACToUse != null)
                            {
                                my1k.Initialize(HashBitLen, MACToUse, null, 0, 0, 0);
                                Result = my1k.ComputeHash(DataToUse, (byte)(InputLen % 8));
                            }
                            else
                            {
                                my1k.Initialize(HashBitLen, null, null, treeLeaf, treeNode, treeMaxLevels);
                                Result = my1k.ComputeHash(DataToUse, (byte)(InputLen % 8));
                            }
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        txtOutput2.AppendText("*EXCEPTION!!!!! " + Thing + "\r\n");
                        MessageBox.Show("EXCEPTION: " + ex.Message + "\r\n" + ex.StackTrace);
                    }

                    string ResultString = Bytes2HexString(Result);

                    if (ThingParts.Length == 6)
                    {
                        if (ResultString.CompareTo(ThingParts[5]) == 0)
                        {
                            txtOutput3.AppendText("-PASS:"******"\r\n");
                        }
                        else
                        {
                            txtOutput3.AppendText("*FAIL:" + Thing + "\r\n");
                        }
                    }
                    else if (ThingParts.Length == 8)
                    {
                        if (ResultString.CompareTo(ThingParts[7]) == 0)
                        {
                            txtOutput3.AppendText("-PASS:"******"\r\n");
                        }
                        else
                        {
                            txtOutput3.AppendText("*FAIL:" + Thing + "\r\n");
                        }
                    }
                    else
                    {
                        if (ResultString.CompareTo(ThingParts[4]) == 0)
                        {
                            txtOutput3.AppendText("-PASS:"******"\r\n");
                        }
                        else
                        {
                            txtOutput3.AppendText("*FAIL:" + Thing + "\r\n");
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("FOR EACH EXCEPTION: " + ex.Message + "\r\n" + ex.StackTrace);
                }
                completedTests++;
            } //end foreach Thing
            return(completedTests);
        }     //end RunAgainstKats
示例#2
0
        private void RunAgainstAs()
        {
            Skein.Skein256Ex  my256 = new Skein.Skein256Ex();
            Skein.Skein512Ex  my512 = new Skein.Skein512Ex();
            Skein.Skein1024Ex my1k  = new Skein.Skein1024Ex();
            int    completedTests   = 0;
            UInt64 runningByteCount = 0;

            //int passedTests = 0;
            //int failedTests = 0;
            byte[] result = null;
            System.Diagnostics.Stopwatch overAllSW = new System.Diagnostics.Stopwatch();
            System.Diagnostics.Stopwatch testSW    = new System.Diagnostics.Stopwatch();

            overAllSW.Start();
            foreach (string Thing in lstTests.SelectedItems)
            {
                string[] pieces      = Thing.Split(new char[] { ',' });
                string   lengthParse = pieces[2].Replace("length=", "");
                int      length      = int.Parse(lengthParse);
                //note:
                //doing this versus "string = new string('a', length)" accomplishes the same thing.
                //the problem with the new string method is it consumes TONS of memory needlessly.
                //this method of just starting with a byte array works just as fast, and uses 1/5th the memory!!!
                byte[] source = new byte[length];
                for (int i = 0; i < length; i++)
                {
                    source[i] = 0x61; // 'a'
                }
                //end note
                runningByteCount += (ulong)source.Length;
                testSW.Start();
                switch (int.Parse(pieces[0]))
                {
                case 256:
                    my256.Initialize(uint.Parse(pieces[1]), null, null, 0, 0, 0);
                    result = my256.ComputeHash(source);
                    break;

                case 512:
                    my512.Initialize(uint.Parse(pieces[1]), null, null, 0, 0, 0);
                    result = my512.ComputeHash(source);
                    break;

                case 1024:
                    my1k.Initialize(uint.Parse(pieces[1]), null, null, 0, 0, 0);
                    result = my1k.ComputeHash(source);
                    break;
                }
                testSW.Stop();
                string testDuration = testSW.Elapsed.Duration().ToString(@"h\:mm\:ss\.fffff");
                txtResults.AppendText(Thing + ", " + testDuration + "     RESULT(base64):\r\n");
                txtResults.AppendText(Convert.ToBase64String(result, Base64FormattingOptions.InsertLineBreaks) + "\r\n\r\n");
                result = null;
                source = null;
                //if (completedTests % 15 == 0 || testSW.Elapsed.TotalSeconds > 5)
                //    System.GC.Collect();
                completedTests++;
                if (completedTests % 10 == 0 || testSW.Elapsed.TotalSeconds > 2)
                {
                    tslblStatus.Text = completedTests.ToString() + " tests complete... Still Running...";
                }
                Application.DoEvents();
                testSW.Reset();
            }
            overAllSW.Stop();
            Double bytesPerSec = runningByteCount / overAllSW.Elapsed.TotalSeconds;

            ssMain.Items["tslblStatus"].Text = "Done in " + overAllSW.Elapsed.Duration().ToString(@"h\:mm\:ss\.ffff") + ". " +
                                               completedTests.ToString() + " Tests Complete " +
                                               (runningByteCount / 1024).ToString() + " KBytes processed (" + bytesPerSec.ToString("0.0") + " bytes/sec or " +
                                               (bytesPerSec / 1048576).ToString("0.0") + " MB/sec) "; //: " +
            //passedTests.ToString() + " PASSED, " + failedTests.ToString() + " FAILED";
        }
示例#3
0
        private void PerformCodeCoverageTests()
        {
            byte[] testMe    = new byte[1024];
            byte[] tweakMe   = new byte[16];
            byte[] keyMe256  = new byte[32];
            byte[] keyMe512  = new byte[64];
            byte[] keyMe1024 = new byte[128];
            Random myRandom  = new Random(DateTime.Now.Millisecond);

            myRandom.NextBytes(testMe);
            myRandom.NextBytes(keyMe256);
            myRandom.NextBytes(keyMe512);
            myRandom.NextBytes(keyMe1024);
            myRandom.NextBytes(tweakMe);

            testMe = new System.Security.Cryptography.PBKDF2HMACSkein512(tweakMe, keyMe256, 100).GetBytes(1024);
            //testMe = new SkeinLib.DeriveBytesEx(tweakMe, keyMe256, 100).GetBytes(1024);

            byte[] result    = SkeinTester.ThreeFishWrappers.ThreeFish256Bytes(testMe, keyMe256, tweakMe);
            byte[] invResult = SkeinTester.ThreeFishWrappers.InvThreeFish256Bytes(result, keyMe256, tweakMe);
            //byte[] result = SkeinLib.ThreeFish.ThreeFish256Bytes(testMe, keyMe256, tweakMe);
            //byte[] invResult = SkeinLib.ThreeFish.InvThreeFish256Bytes(result, keyMe256, tweakMe);
            string source   = Convert.ToBase64String(testMe);
            string resource = Convert.ToBase64String(invResult);

            if (source.Equals(resource))
            {
                txtResults.AppendText("ThreeFish256 Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*ThreeFish256 Test FAIL!\r\n");
            }

            myRandom.NextBytes(testMe);
            result    = SkeinTester.ThreeFishWrappers.ThreeFish512Bytes(testMe, keyMe512, tweakMe);
            invResult = SkeinTester.ThreeFishWrappers.InvThreeFish512Bytes(result, keyMe512, tweakMe);
            //result = SkeinLib.ThreeFish.ThreeFish512Bytes(testMe, keyMe512, tweakMe);
            //invResult = SkeinLib.ThreeFish.InvThreeFish512Bytes(result, keyMe512, tweakMe);
            source   = Convert.ToBase64String(testMe);
            resource = Convert.ToBase64String(invResult);
            if (source.Equals(resource))
            {
                txtResults.AppendText("ThreeFish512 Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*ThreeFish512 Test FAIL!\r\n");
            }

            myRandom.NextBytes(testMe);
            result    = SkeinTester.ThreeFishWrappers.ThreeFish1024Bytes(testMe, keyMe1024, tweakMe);
            invResult = SkeinTester.ThreeFishWrappers.InvThreeFish1024Bytes(result, keyMe1024, tweakMe);
            //result = SkeinLib.ThreeFish.ThreeFish1024Bytes(testMe, keyMe1024, tweakMe);
            //invResult = SkeinLib.ThreeFish.InvThreeFish1024Bytes(result, keyMe1024, tweakMe);
            source   = Convert.ToBase64String(testMe);
            resource = Convert.ToBase64String(invResult);
            if (source.Equals(resource))
            {
                txtResults.AppendText("ThreeFish1024 Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*ThreeFish1024 Test FAIL!\r\n");
            }

            byte[] array1     = new byte[] { 1, 1, 1, 1, 1, 1, 1 };
            byte[] array2     = new byte[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 };
            byte[] array1long = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5 };
            byte[] array2long = new byte[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 0, 0 };



            result    = new Skein.Skein256Ex().ComputeHash(array1);
            invResult = new Skein.Skein256Ex().ComputeHash(new ArraySegment <byte>(array2, 2, array1.Length));
            //result = new SkeinLib.Skein256Ex().ComputeHash(array1);
            //invResult = new SkeinLib.Skein256Ex().ComputeHash(new ArraySegment<byte>(array2, 2, array1.Length));
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("ArraySegment Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*ArraySegment Test FAIL!!!\r\n");
            }

            result    = new Skein.Skein256Ex().ComputeHash(array1long);
            invResult = new Skein.Skein256Ex().ComputeHash(new ArraySegment <byte>(array2long, 2, array1long.Length));
            //result = new SkeinLib.Skein256Ex().ComputeHash(array1long);
            //invResult = new SkeinLib.Skein256Ex().ComputeHash(new ArraySegment<byte>(array2long, 2, array1long.Length));
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("ArraySegment Long Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*ArraySegment Long Test FAIL!!!\r\n");
            }

            System.Security.Cryptography.Skein256Managed testSSC = new System.Security.Cryptography.Skein256Managed();
            result = testSSC.ComputeHash(array1);
            Skein.Skein256Ex testSkeinEx = new Skein.Skein256Ex();
            //SkeinLib.Skein256Ex testSkeinEx = new SkeinLib.Skein256Ex();
            invResult = testSkeinEx.ComputeHash(array1);
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("System.Security.Crpyto.SkeinHashAlgorithm Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*System.Security.Crpyto.SkeinHashAlgorithm Test FAIL!!!\r\n");
            }


            testSSC     = new System.Security.Cryptography.Skein256Managed();
            result      = testSSC.ComputeHash(keyMe1024);
            testSkeinEx = new Skein.Skein256Ex();
            //testSkeinEx = new SkeinLib.Skein256Ex();
            invResult = testSkeinEx.ComputeHash(keyMe1024);
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("System.Security.Crpyto.SkeinHashAlgorithm Long Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*System.Security.Crpyto.SkeinHashAlgorithm Long Test FAIL!!!\r\n");
            }

            testMe = new System.Security.Cryptography.PBKDF2HMACSkein512(tweakMe, keyMe256, 100).GetBytes(1028);
            //testMe = new SkeinLib.DeriveBytesEx(tweakMe, keyMe256, 100).GetBytes(1028);
            testSSC     = new System.Security.Cryptography.Skein256Managed();
            result      = testSSC.ComputeHash(testMe);
            testSkeinEx = new Skein.Skein256Ex();
            //testSkeinEx = new SkeinLib.Skein256Ex();
            invResult = testSkeinEx.ComputeHash(testMe);
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("System.Security.Crpyto.SkeinHashAlgorithm Long Test2 SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*System.Security.Crpyto.SkeinHashAlgorithm Long Test2 FAIL!!!\r\n");
            }

            System.Security.Cryptography.HMACSkein256Managed testHSSC = new System.Security.Cryptography.HMACSkein256Managed();
            testHSSC.Key = keyMe256;
            result       = testHSSC.ComputeHash(array1);
            testSkeinEx  = new Skein.Skein256Ex(256, keyMe256);
            //testSkeinEx = new SkeinLib.Skein256Ex(256, keyMe256);
            invResult = testSkeinEx.ComputeHash(array1);
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("System.Security.Crpyto.HMACSkeinHashAlgorithm SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*System.Security.Crpyto.HMACSkeinHashAlgorithm FAIL!!!\r\n");
            }

            testHSSC     = new System.Security.Cryptography.HMACSkein256Managed();
            testHSSC.Key = keyMe256;
            result       = testHSSC.ComputeHash(keyMe1024);
            testSkeinEx  = new Skein.Skein256Ex(256, keyMe256);
            //testSkeinEx = new SkeinLib.Skein256Ex(256, keyMe256);
            invResult = testSkeinEx.ComputeHash(keyMe1024);
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("System.Security.Crpyto.HMACSkeinHashAlgorithm Long Test SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*System.Security.Crpyto.HMACSkeinHashAlgorithm Long Test FAIL!!!\r\n");
            }

            testMe       = new System.Security.Cryptography.PBKDF2HMACSkein512(tweakMe, keyMe256, 100).GetBytes(1028);
            testHSSC     = new System.Security.Cryptography.HMACSkein256Managed();
            testHSSC.Key = keyMe256;
            result       = testHSSC.ComputeHash(testMe);
            testSkeinEx  = new Skein.Skein256Ex(256, keyMe256);
            //testSkeinEx = new SkeinLib.Skein256Ex(256, keyMe256);
            invResult = testSkeinEx.ComputeHash(testMe);
            if (Convert.ToBase64String(result) == Convert.ToBase64String(invResult))
            {
                txtResults.AppendText("System.Security.Crpyto.HMACSkeinHashAlgorithm Long Test2 SUCCESSFULL!\r\n");
            }
            else
            {
                txtResults.AppendText("*System.Security.Crpyto.HMACSkeinHashAlgorithm Long Test2 FAIL!!!\r\n");
            }
        }
示例#4
0
        private void RunAgainstKats()
        {
            Skein.SkeinEx my256          = new Skein.Skein256Ex();
            Skein.SkeinEx my512          = new Skein.Skein512Ex();
            Skein.SkeinEx my1k           = new Skein.Skein1024Ex();
            int           completedTests = 0;
            int           passedTests    = 0;
            int           failedTests    = 0;

            System.Diagnostics.Stopwatch overAllSW = new System.Diagnostics.Stopwatch();
            System.Diagnostics.Stopwatch testSW    = new System.Diagnostics.Stopwatch();

            overAllSW.Start();
            foreach (string Thing in lstTests.SelectedItems)
            {
                //try
                //{
                string[] ThingParts = Thing.Split('^');
                byte[]   DataToUse  = null;
                UInt16   HashBitLen;
                int      MACInputLen;
                byte[]   MACToUse = null;
                byte     treeNode;
                byte     treeLeaf;
                byte     treeMaxLevels;

                int InputLen = int.Parse(ThingParts[3].Replace("L", String.Empty));

                if (ThingParts.Length == 8)
                {
                    treeLeaf      = byte.Parse(ThingParts[4].Replace("LF", string.Empty), System.Globalization.NumberStyles.HexNumber);
                    treeNode      = byte.Parse(ThingParts[5].Replace("ND", string.Empty), System.Globalization.NumberStyles.HexNumber);
                    treeMaxLevels = byte.Parse(ThingParts[6].Replace("ML", string.Empty), System.Globalization.NumberStyles.HexNumber);
                }
                else
                {
                    treeLeaf      = 0;
                    treeNode      = 0;
                    treeMaxLevels = 0;
                }

                //create sub-arrays of data, otherwise Skein functions will use ENTIRE array
                if (ThingParts.Length == 6)
                {
                    MACInputLen = int.Parse(ThingParts[4].Replace("MAC", String.Empty));
                    MACToUse    = new byte[MACInputLen];
                    Buffer.BlockCopy(MACKey, 0, MACToUse, 0, MACInputLen);
                }
                else
                {
                    MACToUse = null;
                }

                if (InputLen == 0)
                {
                    DataToUse = null;
                }
                else
                {
                    int numBytes;
                    int numExtraBits;
                    numBytes = Math.DivRem(InputLen, 8, out numExtraBits);
                    if (numExtraBits > 0)
                    {
                        DataToUse = new byte[numBytes + 1];
                    }
                    else
                    {
                        DataToUse = new byte[numBytes];
                    }
                    System.Diagnostics.Debug.Print("INPUTLEN: " + InputLen.ToString() + " DATATOUSE.LENGTH: " + DataToUse.Length.ToString());
                    switch (ThingParts[0].ToLower())
                    {
                    case "incrementing":
                        Buffer.BlockCopy(IncrementingDataSrc, 0, DataToUse, 0, DataToUse.Length);
                        break;

                    case "random":
                        Buffer.BlockCopy(RandomDataSrc, 0, DataToUse, 0, DataToUse.Length);
                        break;

                    case "zero":
                        Buffer.BlockCopy(ZeroDataSrc, 0, DataToUse, 0, DataToUse.Length);
                        break;

                    case "random_mac":
                        Buffer.BlockCopy(RandomMACDataSrc, 0, DataToUse, 0, DataToUse.Length);
                        break;

                    case "tree":
                        switch (ThingParts[1].ToLower())
                        {
                        case "s256": Buffer.BlockCopy(TreeDataSrc256, 0, DataToUse, 0, DataToUse.Length); break;

                        case "s512": Buffer.BlockCopy(TreeDataSrc512, 0, DataToUse, 0, DataToUse.Length); break;

                        case "s1024": Buffer.BlockCopy(TreeDataSrc1k, 0, DataToUse, 0, DataToUse.Length); break;
                        }
                        break;

                    default:
                        //this.txtOutput2.AppendText("Skip UNKNOWN test:" + Thing.Substring(0, 60) + "\r\n");
                        continue;
                    }
                }
                HashBitLen = UInt16.Parse(ThingParts[2].Replace("H", String.Empty));
                byte[] Result = null;

                //try
                //{
                testSW.Start();
                switch (ThingParts[1].ToLower())
                {
                case "s256":
                    if (Thing.ToLower().Contains("mac") && MACToUse != null)
                    {
                        my256.Initialize(HashBitLen, MACToUse, null, 0, 0, 0);
                    }
                    else
                    {
                        my256.Initialize(HashBitLen, null, null, treeLeaf, treeNode, treeMaxLevels);
                    }
                    Result = my256.ComputeHash(DataToUse, (byte)(InputLen % 8));
                    break;

                case "s512":
                    if (Thing.ToLower().Contains("mac") && MACToUse != null)
                    {
                        my512.Initialize(HashBitLen, MACToUse, null, 0, 0, 0);
                    }
                    else
                    {
                        my512.Initialize(HashBitLen, null, null, treeLeaf, treeNode, treeMaxLevels);
                    }
                    Result = my512.ComputeHash(DataToUse, (byte)(InputLen % 8));
                    break;

                case "s1024":
                    if (Thing.ToLower().Contains("mac") && MACToUse != null)
                    {
                        my1k.Initialize(HashBitLen, MACToUse, null, 0, 0, 0);
                    }
                    else
                    {
                        my1k.Initialize(HashBitLen, null, null, treeLeaf, treeNode, treeMaxLevels);
                    }
                    Result = my1k.ComputeHash(DataToUse, (byte)(InputLen % 8));
                    break;
                }
                //}
                //catch (Exception ex)
                //{
                //this.txtOutput2.AppendText("*EXCEPTION!!!!! " + Thing + "\r\n");
                //    MessageBox.Show("EXCEPTION: " + ex.Message + "\r\n" + ex.StackTrace);
                //}
                testSW.Stop();
                string ResultString = Bytes2HexString(Result);
                string testAbrvName = Thing.Replace(ThingParts[ThingParts.GetUpperBound(0)], string.Empty).Replace('^', '\t');
                string testDuration = testSW.Elapsed.ToString(@"h\:mm\:ss\.fffff");

                if (ThingParts.Length == 6)
                {
                    if (ResultString.CompareTo(ThingParts[5]) == 0)
                    {
                        passedTests++;
                        txtResults.AppendText("-PASS in " + testDuration + " " + testAbrvName + "\r\n");
                    }
                    else
                    {
                        failedTests++;
                        txtResults.AppendText("*FAIL in " + testDuration + " " + Thing + "\r\n");
                        //this.txtResults.AppendText(" EXPECTED: " + ThingParts[5] + "\r\n");
                        //this.txtResults.AppendText(" RESULT  : " + ResultString + "\r\n");
                    }
                }
                else if (ThingParts.Length == 8)
                {
                    if (ResultString.CompareTo(ThingParts[7]) == 0)
                    {
                        passedTests++;
                        txtResults.AppendText("-PASS in " + testDuration + " " + testAbrvName + "\r\n");
                    }
                    else
                    {
                        failedTests++;
                        txtResults.AppendText("*FAIL in " + testDuration + " " + Thing + "\r\n");
                        //this.txtResults.AppendText(" EXPECTED: " + ThingParts[7] + "\r\n");
                        //this.txtResults.AppendText(" RESULT  : " + ResultString + "\r\n");
                    }
                }
                else
                {
                    if (ResultString.CompareTo(ThingParts[4]) == 0)
                    {
                        passedTests++;
                        txtResults.AppendText("-PASS in " + testDuration + " " + testAbrvName + "\r\n");
                    }
                    else
                    {
                        failedTests++;
                        txtResults.AppendText("*FAIL in " + testDuration + " " + Thing + "\r\n");
                        //this.txtResults.AppendText(" EXPECTED: " + ThingParts[4] + "\r\n");
                        //this.txtResults.AppendText(" RESULT  : " + ResultString + "\r\n");
                    }
                }

                //}
                //catch (Exception ex)
                //{
                //    MessageBox.Show("'FOR-EACH' EXCEPTION: " + ex.Message + "\r\n" + ex.StackTrace);
                //}
                testSW.Reset();
                completedTests++;
                Application.DoEvents();
            } //end foreach Thing
            overAllSW.Stop();
            ssMain.Items["tslblStatus"].Text = "Done in " + overAllSW.Elapsed.Duration().ToString(@"h\:mm\:ss\.ffff")
                                               + "  " + completedTests.ToString() + " Tests Complete: " +
                                               passedTests.ToString() + " PASSED, " + failedTests.ToString() + " FAILED";

            return;
        }//end RunAgainstKats