public static SaltMd5 Init(string stringToHash, string salt)
        {
            if (salt != null && !salt.StartsWith(REQUIRED_MD5_SALT_PREFIX))
                throw new ArgumentException("Invalid salt format. Should be $1$********");

            var hash = new SaltMd5 { _stringToHash = stringToHash, _salt = salt };
            return hash;
        }
Example #2
0
 public static string EncryptString(HashType ht, string str, string salt = null)
 {
     switch (ht)
     {
     case HashType.Md5:
         var md5 = SaltMd5.Init(str, salt);
         return(md5.ToBfFormat());
     }
     throw new PostfixEncryptorException("This hash type doesn't implemented.");
 }
Example #3
0
        public static SaltMd5 Init(string stringToHash, string salt)
        {
            if (salt != null && !salt.StartsWith(REQUIRED_MD5_SALT_PREFIX))
            {
                throw new ArgumentException("Invalid salt format. Should be $1$********");
            }

            var hash = new SaltMd5 {
                _stringToHash = stringToHash, _salt = salt
            };

            return(hash);
        }
        public static SaltMd5 Init(string string_to_hash, string salt)
        {
            if (salt != null && !salt.StartsWith(RequiredMd5SaltPrefix))
            {
                throw new ArgumentException("Invalid salt format. Should be $1$********");
            }

            var hash = new SaltMd5 {
                _stringToHash = string_to_hash, _salt = salt
            };

            return(hash);
        }