Ejemplo n.º 1
0
        public void GetHash_GivenValue_ReturnsHash()
        {
            const string expected = "f84fda43760b7599e7b2aa386d05e9350ebfba83d159b5fd6e3c0782db26c2af";
            var          result   = _uut.GetHash("bjorni");

            Assert.Equal(expected.ToUpper(), result);
        }
Ejemplo n.º 2
0
        public string Hashify(string algorithme, string plaintext, string salt)
        {
            IHashingAlgorithme hasher;

            switch (algorithme)
            {
            case "MD5": hasher = new HashingAlgorithmeMd5(); break;

            case "SHA1": hasher = new HashingAlgorithmeSha1();; break;

            case "SHA256": hasher = new HashingAlgorithmeSha256(); break;

            case "SHA384": hasher = new HashingAlgorithmeSha384(); break;

            case "SHA512": hasher = new HashingAlgorithmeSha512(); break;

            default: hasher = new HashingAlgorithmeSha256(); break;
            }

            return(hasher.GetHash(plaintext, salt));
        }