Exemplo n.º 1
0
        public string BHasherMdjb2Test(string toHash)
        {
            BHasher hasher = new BHasherMdjb2();

            byte[] byt = Encoding.ASCII.GetBytes(toHash);
            hasher.Add(byt, 0, byt.Length);
            BHash hash = hasher.Finish();

            // System.Console.WriteLine("BHasherMdjb2 hash output = " + hash.ToString());
            return(hash.ToString());
        }
Exemplo n.º 2
0
        public ulong BHasherMdjb2TestParams()
        {
            BHasher hasher = new BHasherMdjb2();

            hasher.Add('c');
            hasher.Add((ushort)6);
            hasher.Add((int)12345);
            hasher.Add(-2345L);
            byte[] byt = Encoding.ASCII.GetBytes("This is a string");
            hasher.Add(byt, 0, byt.Length);
            BHash hash = hasher.Finish();

            // System.Console.WriteLine("BHasher hash output = " + hash.ToString());
            return(hash.ToULong());
        }
Exemplo n.º 3
0
        public void BHasherParameterParts()
        {
            byte[] testBytes = new byte[100];
            Random rand      = new Random();

            rand.NextBytes(testBytes);
            BHasher hasher1 = new BHasherMdjb2();
            BHasher hasher2 = new BHasherMdjb2();

            TestHasher("Mdjb2", hasher1, hasher2, testBytes);
            hasher1 = new BHasherMD5();
            hasher2 = new BHasherMD5();
            TestHasher("MD5", hasher1, hasher2, testBytes);
            hasher1 = new BHasherSHA256();
            hasher2 = new BHasherSHA256();
            TestHasher("SHA256", hasher1, hasher2, testBytes);
        }