public void Should_Generate_512Bit_Hexadecimal_String()
        {
            var rg  = new RandomGenerators();
            var str = rg.Generate512BitKey();

            Assert.IsNotNull(str);
            Assert.IsTrue(str.Length == 128);
        }
        public void HashPassword_Should_Return_Success_And_PasswordHashingData_Object()
        {
            var rg  = new RandomGenerators();
            var phs = new PasswordHashingSvc(rg.Generate512BitKey());

            const string password = "******";
            var          hashed   = phs.HashPassword(password);

            Assert.IsTrue(hashed.IsSuccessful);
            Assert.AreEqual(hashed.Value.HashedPassword.Length, 128);
        }
        public void HashPassword_Should_Return_Different_HashedValues_For_The_Same_Value_Computed_Twice()
        {
            var rg  = new RandomGenerators();
            var phs = new PasswordHashingSvc(rg.Generate512BitKey());

            const string password      = "******";
            var          hashedResult1 = phs.HashPassword(password);
            var          hashedResult2 = phs.HashPassword(password);

            Assert.AreNotEqual(hashedResult1.Value.HashedPassword, hashedResult2.Value.HashedPassword);
        }
        public void ComputePasswordAndSaltBytes_Should_Generate_Sha512_ByteArray()
        {
            var rg  = new RandomGenerators();
            var phs = new PasswordHashingSvc(rg.Generate512BitKey());

            var salt = new byte[32];

            rg.GenerateRandomBytes(salt);
            var rand          = new Random();
            var computeResult = phs.ComputePasswordAndSaltBytes(salt, "my password 1234 #*@", rand.Next(8200, 14000));

            Assert.IsTrue(computeResult.IsSuccessful);
            Assert.AreEqual(computeResult.Value.Length, 64);
        }