Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: HIGH MERCURY LEVELS IN DOLPHINS Pin
leppie22-Feb-03 21:57
leppie22-Feb-03 21:57 
GeneralRe: HIGH MERCURY LEVELS IN DOLPHINS Pin
eggie523-Feb-03 13:19
eggie523-Feb-03 13:19 
GeneralRe: HIGH MERCURY LEVELS IN DOLPHINS Pin
John Karbin24-Feb-03 2:31
John Karbin24-Feb-03 2:31 
GeneralRe: HIGH MERCURY LEVELS IN DOLPHINS Pin
eggie524-Feb-03 4:08
eggie524-Feb-03 4:08 
GeneralRe: HIGH MERCURY LEVELS IN DOLPHINS Pin
John Karbin24-Feb-03 4:29
John Karbin24-Feb-03 4:29 
Generalencrypting question Pin
jtmtv1822-Feb-03 13:29
jtmtv1822-Feb-03 13:29 
GeneralRe: encrypting question Pin
Furty22-Feb-03 17:57
Furty22-Feb-03 17:57 
GeneralRe: encrypting question Pin
jtmtv1822-Feb-03 19:04
jtmtv1822-Feb-03 19:04 
thanks furty i found something that fixed the problem for me using RC2 and memory streams... i used that path class...and sent just the name to the seperate "class" where the name was encrypted and then returned.... apon decryption i send the "encrypted" name back...and it decrypted that string using the same password... you were write on the last part.. i just had no idea how to do it because when i did it...it would encrypt the string and return a name that was too long...for a valid windows file name. the following code encrypted the string and fixed the problem...

thanks... Jesse M


please keep in mind this encryption method i know isnt the correct way to do it...but its just for a file name.. so i did it the easyiest way =)..
public string FilterInName(string pToEncrypt){<br />
			try{<br />
				if(pToEncrypt.Length<=3){<br />
<br />
					return pToEncrypt;<br />
				}<br />
				string sKey = "alPhatab";<br />
				DESCryptoServiceProvider des = new DESCryptoServiceProvider();<br />
				//Put the string into a byte array<br />
				byte[] inputByteArray = Encoding.Default.GetBytes(pToEncrypt);<br />
				//Create the crypto objects, with the key, as passed in<br />
				des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);<br />
				des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);<br />
				MemoryStream ms = new MemoryStream();<br />
				CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(),<br />
				CryptoStreamMode.Write);<br />
				//Write the byte array into the crypto stream<br />
				//(It will end up in the memory stream)<br />
				cs.Write(inputByteArray, 0, inputByteArray.Length);<br />
				cs.FlushFinalBlock();<br />
				<br />
				//Get the data back from the memory stream, and into a string<br />
				StringBuilder ret = new StringBuilder();<br />
				foreach(byte b in ms.ToArray()){<br />
				//Format as hex<br />
				ret.AppendFormat("{0:X2}", b);<br />
				}<br />
				return ret.ToString();<br />
			}catch(Exception ){return pToEncrypt;}


The Code Project Is Your Friend...
QuestionFitting a form in a control? Pin
Arun Bhalla22-Feb-03 11:42
Arun Bhalla22-Feb-03 11:42 
AnswerRe: Fitting a form in a control? Pin
leppie22-Feb-03 12:19
leppie22-Feb-03 12:19 
GeneralRe: Fitting a form in a control? Pin
James T. Johnson22-Feb-03 17:07
James T. Johnson22-Feb-03 17:07 
QuestionIs it me or does poeple have less problems with .NET on weekends? Pin
leppie22-Feb-03 11:23
leppie22-Feb-03 11:23 
Questionhow can I Change Type "String" to "char *" within C#? Pin
c.jack22-Feb-03 0:41
c.jack22-Feb-03 0:41 
AnswerRe: how can I Change Type "String" to "char *" within C#? Pin
leppie22-Feb-03 0:45
leppie22-Feb-03 0:45 
AnswerThere are several ways: you can use the unsafe keyword and the Marshal class in the System.Runtime.Interop namespace. But if you are calling an external function, you can use the MarshalAs, it would be a more efficient way. It depends on what you are Pin
Daniel Turini22-Feb-03 0:57
Daniel Turini22-Feb-03 0:57 
GeneralHence my vague reply Pin
leppie22-Feb-03 1:02
leppie22-Feb-03 1:02 
AnswerRe: how can I Change Type "String" to "char *" within C#? Pin
Stephane Rodriguez.22-Feb-03 1:50
Stephane Rodriguez.22-Feb-03 1:50 
GeneralRe: how can I Change Type "String" to "char *" within C#? Pin
c.jack23-Feb-03 15:14
c.jack23-Feb-03 15:14 
GeneralAccessing varibles across forms. Pin
draco_iii21-Feb-03 23:23
draco_iii21-Feb-03 23:23 
GeneralRe: Accessing varibles across forms. Pin
leppie21-Feb-03 23:44
leppie21-Feb-03 23:44 
GeneralRe: Accessing varibles across forms. Pin
draco_iii22-Feb-03 23:46
draco_iii22-Feb-03 23:46 
GeneralRe: Accessing varibles across forms. Pin
leppie23-Feb-03 0:09
leppie23-Feb-03 0:09 
GeneralRe: Accessing varibles across forms. Pin
draco_iii23-Feb-03 14:53
draco_iii23-Feb-03 14:53 
GeneralRe: Accessing varibles across forms. Pin
Stephane Rodriguez.21-Feb-03 23:57
Stephane Rodriguez.21-Feb-03 23:57 
GeneralRe: Accessing varibles across forms. Pin
draco_iii22-Feb-03 21:32
draco_iii22-Feb-03 21:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.