Click here to Skip to main content
15,890,690 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# / XML attributes and values Pin
Oleksandr Kucherenko3-Apr-03 4:28
Oleksandr Kucherenko3-Apr-03 4:28 
GeneralRe: C# / XML attributes and values Pin
econner3-Apr-03 6:54
econner3-Apr-03 6:54 
QuestionCan this be done ? Pin
Steve Murrell3-Apr-03 1:36
Steve Murrell3-Apr-03 1:36 
AnswerRe: Can this be done ? Pin
neroknights3-Apr-03 9:23
neroknights3-Apr-03 9:23 
GeneralRe: Can this be done ? Pin
Steve Murrell3-Apr-03 21:30
Steve Murrell3-Apr-03 21:30 
GeneralRe: Can this be done ? Pin
neroknights4-Apr-03 3:51
neroknights4-Apr-03 3:51 
GeneralRe: Can this be done ? Pin
Steve Murrell4-Apr-03 5:35
Steve Murrell4-Apr-03 5:35 
GeneralFileStream.Seek and Encryption Question Pin
jtmtv182-Apr-03 21:56
jtmtv182-Apr-03 21:56 
hey guys and girls,
im trying to get the ability to embed a hastable value of the password im going to encrypt a file with, in the file its self (but not embedding the password its self though just the hastable it generates). After encrypting it like above, i want the decryptor to beable to compare the incoming password to the hashtable on the encrypted file, if the 2 match, then continue, my problem is i need the incoming stream, to seek passed the hashtable and start there (SeekOrigin.Begin), so the original data is intact,the problem is when i use the FileStream.Seek = Seek(hashtablelength,SeekOrigin.Begin) when it gets to the actualy decryption part, it freezes and doesnt do anything, Ill include the code below, Am i just not doing it right ? If i was unable to make my question clear enough please let me know,

Jesse M

(i clipped the code so it will not be 100% correct, but the bulk of it is there)

///
///Decryption Method
///
<br />
 //Create the file streams to handle the input and output files.<br />
						    FileStream fin = new FileStream(inName, FileMode.Open, FileAccess.Read);<br />
						    FileStream fout = new FileStream(outName, FileMode.OpenOrCreate, FileAccess.Write);<br />
						    fout.SetLength(0);<br />
						    //Create variables to help with read and write.<br />
						    byte[] bin = new byte[buffersize]; //This is intermediate storage for the encryption.<br />
						    long rdlen = 0;              //This is the total number of bytes written.<br />
						    long totlen = fin.Length;    //This is the total length of the input file.<br />
						    int len;                     //This is the number of bytes to be written at a time.<br />
						    //<br />
						    RC2CryptoServiceProvider RC2 = new RC2CryptoServiceProvider(); <br />
							//<br />
							//byte[] prndKey = new byte[]{0x00, 0x74,0xBa,0x12,0x54,0x11,0x75,0x91,0x12,0x71,0x15};<br />
							PasswordDeriveBytes db = new PasswordDeriveBytes(KeySecretString,SaltByte);<br />
							byte[] f= db.GetBytes(RC2.LegalKeySizes[0].MaxSize /16);<br />
							//<br />
							RC2.IV = f;			<br />
							RC2.Key =f;<br />
						    CryptoStream encStream = new CryptoStream(fout, RC2.CreateDecryptor(RC2.Key, RC2.IV), CryptoStreamMode.Write);        <br />
						    Console.WriteLine("Encrypting...");<br />
						    //Read from the input file, then encrypt and write to the output file.<br />
						    while(rdlen < totlen)<br />
						    {<br />
						        len = fin.Read(bin, 0, buffersize);<br />
						        encStream.Write(bin, 0, len);<br />
						        rdlen = rdlen + len;<br />
						    	PD.PerformStep();<br />
						        Console.WriteLine("{0} bytes processed", rdlen);<br />
						    } <br />

The Code Project Is Your Friend...
QuestionHow to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Anthony_Yio2-Apr-03 19:52
Anthony_Yio2-Apr-03 19:52 
AnswerRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Venkatraman2-Apr-03 20:10
Venkatraman2-Apr-03 20:10 
GeneralRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Anthony_Yio2-Apr-03 21:04
Anthony_Yio2-Apr-03 21:04 
GeneralRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Venkatraman2-Apr-03 21:26
Venkatraman2-Apr-03 21:26 
GeneralRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Anthony_Yio2-Apr-03 21:35
Anthony_Yio2-Apr-03 21:35 
GeneralRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Venkatraman2-Apr-03 22:12
Venkatraman2-Apr-03 22:12 
AnswerRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Gaul3-Apr-03 4:45
Gaul3-Apr-03 4:45 
GeneralRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Anthony_Yio3-Apr-03 14:14
Anthony_Yio3-Apr-03 14:14 
AnswerRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
neroknights3-Apr-03 9:44
neroknights3-Apr-03 9:44 
GeneralRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Anthony_Yio3-Apr-03 14:20
Anthony_Yio3-Apr-03 14:20 
GeneralRe: How to pass a delegate object with parameter as input to a ThreadStart constructor? Pin
Anonymous4-Apr-03 3:45
Anonymous4-Apr-03 3:45 
GeneralShow HTML in Windows Application Pin
D.D. de Kerf2-Apr-03 19:49
D.D. de Kerf2-Apr-03 19:49 
GeneralRe: Show HTML in Windows Application Pin
Stephane Rodriguez.2-Apr-03 20:14
Stephane Rodriguez.2-Apr-03 20:14 
GeneralRe: Show HTML in Windows Application Pin
D.D. de Kerf3-Apr-03 0:59
D.D. de Kerf3-Apr-03 0:59 
GeneralRe: Show HTML in Windows Application Pin
Roger Alsing2-Apr-03 21:53
Roger Alsing2-Apr-03 21:53 
GeneralADSI urgent help required Pin
Venkatraman2-Apr-03 19:15
Venkatraman2-Apr-03 19:15 
GeneralRe: ADSI urgent help required Pin
Velichko Sarev2-Apr-03 20:52
Velichko Sarev2-Apr-03 20:52 

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.