示例#1
0
        public void GenerateHash_Long()
        {
            var data = CryptoHelper.GenerateBytes(1000);
            var hash = HashFunctions.GenerateHash(data);

            Assert.AreEqual(HashFunctions.HashSize, hash.Length);
        }
示例#2
0
        static void GenerateHash()
        {
            var data = "P@ssw0rd";
            var hash = HashFunctions.GenerateHash(data);

            Console.WriteLine(hash);

            var data2 = "P@ssw1rd";
            var hash2 = CryptoHelper.GenerateBase64(HashFunctions.HashSize);

            Assert.IsTrue(HashFunctions.VerifyByHash(data, hash));
            Assert.IsFalse(HashFunctions.VerifyByHash(data2, hash));
            Assert.IsFalse(HashFunctions.VerifyByHash(data, hash2));
        }