コード例 #1
0
        /// <summary>
        /// This Method Decrypts Any Value To Original String With Specific Ways Described In The Type
        /// </summary>
        /// <example>string Encryption.Decrypt("BlaBlaBla",Ecryptiontypes.FormAuth);</example>

        public static string Decrypt(string strToDecrypt, SMSEncryptiontypes type)
        {
            string back = "";

            try
            {
                switch (type)
                {
                case SMSEncryptiontypes.Mine:
                    MyEncryption my = new MyEncryption();
                    back = my.Decrypt(strToDecrypt);
                    break;

                case SMSEncryptiontypes.FormAuth:
                    SMSEncryption en = new SMSEncryption();
                    back = en.DecryptFrmAuth(strToDecrypt);
                    break;

                case SMSEncryptiontypes.Des:
                    SymmCrypto sy = new SymmCrypto(SymmCrypto.SymmProvEnum.DES);
                    back = sy.Decrypting(strToDecrypt, "AlHammadKey");
                    break;

                case SMSEncryptiontypes.Rijndal:
                    SymmCrypto syy = new SymmCrypto(SymmCrypto.SymmProvEnum.Rijndael);
                    back = syy.Decrypting(strToDecrypt, "AlHammadKey");
                    break;

                default:
                    break;
                }
            }
            catch
            {
                back = "";
            }
            return(back);
        }
コード例 #2
0
        /// <summary>
        /// This Method Hashs Any String To String With Ways Described In The Provider Parameter
        /// </summary>
        /// <example>string Encryption.Hash("BlaBlaBla" , "SHA1");</example>
        /// <exception cref="> Fires Excpetion If Provider Is Not Found Or Return Empty String"
        public static string Hash(string strToHash, string provider)
        {
            SMSEncryption en = new SMSEncryption();

            return(en.HashMD5(strToHash, provider));
        }