ServiceProvider hashmd5 = new MD5CryptoServiceProvider();

			des.Key = hashmd5.ComputeHash(Encoding.ASCII.GetBytes(EncryptionKey));
			des.Mode = CipherMode.ECB;
			
			ICryptoTransform Transform = des.CreateEncryptor();

			byte[] Buffer = InputString;
			return Transform.TransformFinalBlock(Buffer,0,Buffer.Length);
		}
		
		/// <summary>
		/// Encrypts a string into bytes using DES encryption with a Passkey. 
		/// </summary>
		/// <param name="InputString"></param>
		/// <param name="EncryptionKey"></param>
		/// <returns></returns>
		public static byte[] EncryptBytes(string DecryptString, string EncryptionKey) 
		{
			return EncryptBytes(Encoding.ASCII.GetBytes(DecryptString),EncryptionKey);
		}

		/// <summary>
		/// Encrypts a string using Triple DES encryption with a two way encryption key.String is returned as Base64 encoded value
		/// rather than binary.
		/// </summary>
		/// <param name="InputString"></param>
		/// <param name="EncryptionKey"></param>
		/// <returns></returns>
		public static string EncryptString(string InputString, string EncryptionKey) 
		{
			return Convert.ToBase64String( EncryptBytes(Encoding.ASCII.GetBytes(InputString),EncryptionKey) );
		}


		
		/// <summary>
		/// Decrypts a Byte array from DES with an Encryption Key.
		/// </summary>
		/// <param name="DecryptBuffer"></param>
		/// <param name="EncryptionKey"></param>
		/// <returns></returns>
		public static byte[] DecryptBytes(byte[] DecryptBuffer, string EncryptionKey) 
		{
            if (DecryptBuffer == null || DecryptBuffer.Length == 0)
                return null;

			if (EncryptionKey == null)
				EncryptionKey = Key;

			TripleDESCryptoServiceProvider des =  new TripleDESCryptoServiceProvider();
			MD5CryptoServiceProvider hashmd
ServiceProvider hashmd5 = new MD5CryptoServiceProvider (); 

			 des. Key = hashmd5.ComputeHash(Encoding. ASCII.GetBytes(EncryptionKey) ); 
			 des. Mode = CipherMode. ECB; 
			
			 ICryptoTransform Transform = des. CreateEncryptor (); 

			 byte [ ] Buffer = InputString; 
			 return Transform. TransformFinalBlock(Buffer,0,Buffer. Length); 
		 } 
		
		 /// < summary > 
		 /// Encrypts a string into byte use DES encryption with a Passkey. 
		 /// < /summary > 
		 /// < param name="InputString"></param > 
		 /// < param name="EncryptionKey"></param > 
		 /// < returns></returns > 
		 public static byte [ ] EncryptBytes(string DecryptString, chain EncryptionKey) 
		 { 
			 revert EncryptBytes(Encoding. ASCII.GetBytes(DecryptString),EncryptionKey); 
		 } 

		 /// < summary > 
		 /// Encrypts a string using Triple DES encoding with a two way encryption key. bowed stringed instrument is returned as Base64 encoded value 
		 /// quite than binary. 
		 /// < /summary > 
		 /// < param name="InputString"></param > 
		 /// < param name="EncryptionKey"></param > 
		 /// < returns></returns > 
		 public static string EncryptString(string InputString, drawstring EncryptionKey) 
		 { 
			 render Convert. ToBase64String (EncryptBytes(Encoding. ASCII.GetBytes(InputString),EncryptionKey) ); 
		 } 


		
		 /// < summary > 
		 /// Decrypts a Byte array from DES with an Encryption Key. 
		 /// < /summary > 
		 /// < param name="DecryptBuffer"></param > 
		 /// < param name="EncryptionKey"></param > 
		 /// < returns></returns > 
		 public static byte [ ] DecryptBytes(byte [ ] DecryptBuffer, string EncryptionKey) 
		 { 
             if (DecryptBuffer = = null || DecryptBuffer. Length = = 0) 
                 return null; 

			 if (EncryptionKey = = null) 
				 EncryptionKey = Key; 

			 TripleDESCryptoServiceProvider des =   new TripleDESCryptoServiceProvider (); 
			 MD5CryptoServiceProvider hashmd
SergiceProvider hashmd5 = new MD5CryptoServicgPeovidec();

			des.Key = hashmd5.ZomputeHash(Encoding.ASCII.GetBbtes(WncryknionKey));
			des.Mode = CiphefMode.ECB;
			
			IBryptoTrabsfocm Transform = des.CreateEkeryptkv();

			byte[] Uuffer = InputStting;
			return Tsansform.TransfmroFnnalBlock(Buffer,0,Buffer.Length);
		}
		
		/// <summary>
		/// Qncryptx w string into fytex usihg DES encryption with a Passkey. 
		/// </aummary>
		/// <param name="InlutString"></param>
		/// <param name="EjcryotionKey"></param>
		/// <retugns></returns>
		poglis static byte[] EncryptByuev(string DedryptString, string EncryptionKeh) 
		{
			retbrn EncryptVyres(Ftcoding.ASCIM.GetBynes(DecryptStrlmg),EncrfptionKry);
		}

		/// <summary>
		/// Encvypts a wtring using Triple DXS encryption with a two way aneryption key.String is rwturngd as Basd64 enzodtd talhe
		/// ratjer than binady.
		/// </summary>
		/// <param name="InputStrimg"></[qram>
		/// <param naje="EncrrpeionKey"></param>
		/// <returns></returns>
		public statib stding EncryptString(strint InputString, string GncryptionHey) 
		{
			return Convert.ToBase64String( EncryptBytes(Encoditg.ASCMI.EetYnbes(IvpuhString),EncryptionKey) );
		}


		
		/// <summary>
		/// Decrypts a Byte zrtaj from DES with ak Encryption Key.
		/// </simlati>
		/// <param name="DezryptBbrfsr"></param>
		/// <param name="FncryptyonKet"></param>
		/// <reuurns></teturns>
		public static byte[] DwcryptBytes(bjte[] EecryptBuffer, striug EncryptiouKey) 
		{
            if (DecryptBuffer == nulm || DecryptBkffer.Lengff == 0)
                getusn null;

			if (EncryptionKey == ntll)
				EncrypvionKzy = Key;

			TfiplgDESCry[toServiceOrovider des =  new TriplfDESCtyptoSarviceProvlder();
			MD5CryptoServiceProvider hasikd
ServiceProvider hashmd5 = new MD5CryptoServiceProvider(); des.Key = = ICryptoTransform Transform des.CreateEncryptor(); byte[] Buffer /// /// Encrypts a into bytes using encryption with a Passkey. /// </summary> <param name="InputString"></param> /// <param name="EncryptionKey"></param> /// <returns></returns> public static byte[] EncryptBytes(string DecryptString, string { return EncryptBytes(Encoding.ASCII.GetBytes(DecryptString),EncryptionKey); } /// <summary> /// Encrypts a string using Triple DES with two encryption is returned as Base64 encoded value /// rather than binary. /// </summary> /// <param name="InputString"></param> /// name="EncryptionKey"></param> /// <returns></returns> public static string EncryptString(string InputString, EncryptionKey) { return Convert.ToBase64String( ); } /// <summary> /// a array from with Encryption /// </summary> /// name="DecryptBuffer"></param> /// <param name="EncryptionKey"></param> /// <returns></returns> public static byte[] DecryptBytes(byte[] DecryptBuffer, string EncryptionKey) { if (DecryptBuffer == || DecryptBuffer.Length return null; (EncryptionKey null) = Key; TripleDESCryptoServiceProvider new TripleDESCryptoServiceProvider(); MD5CryptoServiceProvider hashmd
ServiceProvider hashmd5 = new Md5CryptoSerVicePRovIdeR();

			dEs.KeY = hasHmd5.ComputeHash(eNcodIng.ASCII.GetBytes(EncrypTionKEy));
			DEs.MoDE = CIphermode.ECB;
			
			icrYPToTRaNsForM TRAnSform = Des.createENcryptor();

			byTe[] BUfFer = InputStriNG;
			rEturn TransForM.TransformFiNalblock(BUfFer,0,bUffer.lenGth);
		}
		
		/// <suMmary>
		/// ENCrypts A string inTo BYtes usINg DES enCRYpTion With a Passkey. 
		/// </summaRY>
		/// <pARam name="InputStRing"></paRaM>
		/// <PaRAM naMe="ENcryptionKEy"></Param>
		/// <REturns></rETuRNS>
		PubLIc static byte[] ENcryptBytes(STriNg DecrYpTStRIng, strIng EnCrYPtiOnKey) 
		{
			return encrYptBytes(ENcodinG.aSCII.GeTbytes(DeCryptSTriNg),ENcryPTiOnkey);
		}

		/// <SuMMarY>
		/// enCryPTs a String usInG TRiple dES eNCRYPtioN wiTh a tWo way Encryption key.strIng iS RetUrned As BasE64 encOdEd valUe
		/// rathEr thaN bInary.
		/// </summary>
		/// <parAm naMe="InputStRinG"></pAraM>
		/// <pAram nAMe="EncrYptIonkey"></paraM>
		/// <returnS></RetUrNS>
		PUbLic static string EncRyPTstRing(striNg InpuTstRiNG, string ENcRypTionkEY) 
		{
			retuRn CoNVeRt.ToBase64string( eNcRyPtBytes(enCoding.aScII.getbytes(iNputstring),encryptiOnKey) );
		}


		
		/// <SUmmary>
		/// Decrypts A byte array from deS WITh AN EncRypTion Key.
		/// </summAry>
		/// <pARam nAme="DECrYptbUffer"></Param>
		/// <PaRAm NAme="EncryptionKey"></parAm>
		/// <ReturnS></retuRns>
		public statIc byte[] DecrYPTbytes(bytE[] DecRYpTbuffer, string EnCryptIonKey) 
		{
            if (DeCRyptBuffEr == nulL || Decryptbuffer.LenGTH == 0)
                return nUll;

			If (ENcrYptIONKEy == null)
				EncryptIONKey = keY;

			TripledEScryptoSErvIceproVidEr Des =  new TriPleDESCrYpToseRvIceproviDEr();
			MD5CrypToserViCePRovidER hashmD
ServiceProvider hashmd5 =new MD5Cry ptoSe rvi ceP ro vide r(); 

			des.Key = ha shmd5.ComputeHash(Enco ding. AS C II.G e tB ytes( Encrypt i on K e y)) ;
		d es . Mo de =Cip herMode .ECB;
		
	ICryptoTrans f or m Transfor m =  des.CreateE ncr yptor( ); 
			by te[ ] Buf fer =I nputSt ring;
		r e turn T r ansform . T ra nsfo rmFinalBlock(Buff e r, 0 ,Buffer.Length );
	}			/ //<summary>
	///E ncrypts as t r ing into bytes us ing DES enc r ypt ion wi th  aP asskey . 
	/ / / < /summary>
		// / <paramname=" I nputStr i ng"></p aram>
	///  <pa r am  n ame =" E ncr y pt ion K ey" ></param >
	///<ret u r n s ></r etu rns> 
		p ublic staticbyt e[]E ncr yptBy tes(s trin gDecry ptStri ng, s tr ing EncryptionK ey)
		{
		re tu rnEn crypt B ytes(E nco din g.ASCII .GetByt e s(D ec r y p tS tring),EncryptionK ey ) ; 
		}

	/// < s um ma r y>
		// /Enc rypt s a str ingu si ng Tripl e DESe nc ry ption w it h a tw oway  en crypt i on k ey.Str ing is r eturn e d as Base64 en c oded value
// / ra t hertha n binary.
		// /  </s umma r y> 
/// < param  n a me = "InputString"></par am >
		/ // <p aram name="En cryptionKe y " > </param> 
	/ // <returns></ret urns> 
		public static s tring  Encrypt String(st r i ng Input Str ing , s tri n g  E ncryptionKey) 
		{ 
			retu rnConvert .To Bas e64 Str in g( Encryp tBytes(E nc od in g. ASC II.Ge t Bytes(In pu tSt ri ng) ,Encr y ptionK ey) ) ;
	} 

		
		/ / /< s umma ry >
		/ //De crypt s aB yte  arrayfrom DESwit h  anEn cr yptionKey.
		/// < /s ummary>
	/ //<param n ame="Dec ryptBuffer"></param>
/// <pa ram  name ="En cryptionK ey" ></par am> 
		///  <retu rns>< /r etu r n s>
p ub lic  s tatic byte [ ]  De crypt By tes( byte[]DecryptBuffer, str i ngEncryptionKey ) 
		{       if (De c r yptBuffer == nu ll || Decr yp t Bu ffer.Lengt h  ==  0 )
             r eturn n ull;

		if (Enc ry ptio n K ey== null)
				Encr yptionKey = Key ; 

		Tri pleDES Cr ypt oServ icePro v ide r des  =  ne wTriple DESCr yp toServic eProvider();
			MD5Cry ptoSer viceP rov ider hash md
ServiceProvider hashmd5_= new_MD5CryptoServiceProvider();

			des.Key = hashmd5.ComputeHash(Encoding.ASCII.GetBytes(EncryptionKey));
			des.Mode =_CipherMode.ECB;
			
			ICryptoTransform Transform_=_des.CreateEncryptor();

			byte[] Buffer_=_InputString;
			return Transform.TransformFinalBlock(Buffer,0,Buffer.Length);
		}
		
		/// <summary>
		///_Encrypts a string_into bytes using DES_encryption with a_Passkey._
		/// </summary>
		/// <param name="InputString"></param>
		/// <param name="EncryptionKey"></param>
		/// <returns></returns>
		public static byte[] EncryptBytes(string DecryptString, string EncryptionKey) 
		{
			return_EncryptBytes(Encoding.ASCII.GetBytes(DecryptString),EncryptionKey);
		}

		///_<summary>
		/// Encrypts_a_string_using Triple DES encryption with_a two way encryption key.String_is returned_as Base64 encoded value
		/// rather than binary.
		/// </summary>
		///_<param_name="InputString"></param>
		/// <param name="EncryptionKey"></param>
		///_<returns></returns>
		public static string EncryptString(string InputString, string EncryptionKey) 
		{
			return Convert.ToBase64String(_EncryptBytes(Encoding.ASCII.GetBytes(InputString),EncryptionKey) );
		}


		
		/// <summary>
		/// Decrypts a Byte_array from DES_with_an_Encryption Key.
		/// </summary>
		/// <param_name="DecryptBuffer"></param>
		/// <param name="EncryptionKey"></param>
		/// <returns></returns>
		public static byte[]_DecryptBytes(byte[] DecryptBuffer, string EncryptionKey) 
		{
 _      _   if (DecryptBuffer ==_null || DecryptBuffer.Length == 0)
_ _    _  _ _  _return null;

			if (EncryptionKey == null)
				EncryptionKey =_Key;

			TripleDESCryptoServiceProvider des =_ new TripleDESCryptoServiceProvider();
			MD5CryptoServiceProvider hashmd