public void CanHashValues()
        {
            var pass1 = "FeKI*9IZlcQ2Bk$;EEUx";
            var salt1 = "7wEPvh7KFgIX3B1vo1McOPYhkVLUQipLnwZuHEL2l5hAwfGVDjHPTFCtuNVqh33qFfrdboxqidBTKZWtlaJuTSIrS6vvVz7fRktdracm0Q1WBDFNuRnwStmgbYv7bZcV";

            var saltedHasher = new Sha256SaltedHasher();
            var hash1        = saltedHasher.GetHashBytesString(pass1, salt1);
            var hash2        = saltedHasher.GetHashBytesString(pass1, salt1);

            Assert.NotEmpty(hash1);
            Assert.Equal(hash1, hash2);
        }
Пример #2
0
        public AuthService(IUserInfoService userInfoProvider, Sha256SaltedHasher saltedHasher)
        {
            if (userInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(userInfoProvider));
            }
            if (saltedHasher == null)
            {
                throw new ArgumentNullException(nameof(saltedHasher));
            }


            _userInfoService = userInfoProvider;
            _saltedHasher    = saltedHasher;
        }