Click here to Skip to main content
15,886,699 members
Home / Discussions / C#
   

C#

 
GeneralUserControl accessing CodeBehind Pin
Steve McLenithan11-Nov-02 7:14
Steve McLenithan11-Nov-02 7:14 
GeneralRe: UserControl accessing CodeBehind Pin
leppie11-Nov-02 8:25
leppie11-Nov-02 8:25 
GeneralRe: UserControl accessing CodeBehind Pin
Steve McLenithan11-Nov-02 11:18
Steve McLenithan11-Nov-02 11:18 
Questionbinding to rich text controls...howto? Pin
LongRange.Shooter11-Nov-02 4:37
LongRange.Shooter11-Nov-02 4:37 
AnswerRe: binding to rich text controls...howto? Pin
James T. Johnson11-Nov-02 4:41
James T. Johnson11-Nov-02 4:41 
GeneralRe: binding to rich text controls...howto? Pin
LongRange.Shooter11-Nov-02 9:27
LongRange.Shooter11-Nov-02 9:27 
GeneralPassword Encryption Pin
Derek Lakin11-Nov-02 3:50
Derek Lakin11-Nov-02 3:50 
GeneralRe: Password Encryption Pin
David Stone11-Nov-02 4:49
sitebuilderDavid Stone11-Nov-02 4:49 
You're right. It isn't the best way...
//Set up the SHA1 provider and the encoder
//The encoder lets us convert the string back and forth from the bytes that the SHA1 provider requires
SHA1 shaM = new SHA1Managed();
UnicodeEncoding enc = new UnicodeEncoding();

//Perform the encryption
byte[] original = enc.GetBytes(Text);	         //Convert Text to byte form
byte[] converted = shaM.ComputeHash(original);	//Compute the hash
Text = enc.GetString(converted);	                  //Convert bytes back to Text

The UnicodeEncoding class is in the System.Text namespace. I always do something that I think shouldn't take that much...then I find out how I could have saved myself a bunch of time and heartache by just looking for something in the FCL that would do it for me.

Oh, and you aren't supposed to create strings like this:
string hashword = new string(cHash);
You should do it like this:
string hashword = cHash;
Or, you should probably just use cHash instead of creating a new string.


You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark

I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder

GeneralRe: Password Encryption Pin
Derek Lakin11-Nov-02 19:55
Derek Lakin11-Nov-02 19:55 
GeneralRe: Password Encryption Pin
David Stone12-Nov-02 4:42
sitebuilderDavid Stone12-Nov-02 4:42 
GeneralRe: Password Encryption Pin
Derek Lakin12-Nov-02 19:56
Derek Lakin12-Nov-02 19:56 
GeneralRe: Password Encryption Pin
Pete Bassett11-Nov-02 4:59
Pete Bassett11-Nov-02 4:59 
GeneralRe: Password Encryption Pin
David Stone11-Nov-02 4:58
sitebuilderDavid Stone11-Nov-02 4:58 
GeneralRe: Password Encryption Pin
leppie11-Nov-02 6:15
leppie11-Nov-02 6:15 
GeneralRe: Password Encryption Pin
David Stone11-Nov-02 9:23
sitebuilderDavid Stone11-Nov-02 9:23 
GeneralRe: Password Encryption Pin
leppie11-Nov-02 9:58
leppie11-Nov-02 9:58 
GeneralRe: Password Encryption Pin
David Stone11-Nov-02 10:47
sitebuilderDavid Stone11-Nov-02 10:47 
GeneralRe: Password Encryption Pin
Derek Lakin11-Nov-02 19:52
Derek Lakin11-Nov-02 19:52 
GeneralSome inherited form questions.... Pin
LongRange.Shooter11-Nov-02 3:44
LongRange.Shooter11-Nov-02 3:44 
Generalidc_arrow and C# Pin
Senkwe Chanda11-Nov-02 2:20
Senkwe Chanda11-Nov-02 2:20 
GeneralRe: idc_arrow and C# Pin
Stephane Rodriguez.11-Nov-02 3:01
Stephane Rodriguez.11-Nov-02 3:01 
GeneralRe: idc_arrow and C# Pin
Senkwe Chanda11-Nov-02 4:12
Senkwe Chanda11-Nov-02 4:12 
GeneralRe: idc_arrow and C# Pin
Stephane Rodriguez.11-Nov-02 4:13
Stephane Rodriguez.11-Nov-02 4:13 
GeneralRe: idc_arrow and C# Pin
Senkwe Chanda11-Nov-02 18:39
Senkwe Chanda11-Nov-02 18:39 
GeneralRe: idc_arrow and C# Pin
Anonymous11-Nov-02 18:56
Anonymous11-Nov-02 18:56 

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.