Click here to Skip to main content
15,896,518 members
Home / Discussions / C#
   

C#

 
QuestionPlay MKV files in embedded media player Pin
sypack8-Jun-07 2:16
sypack8-Jun-07 2:16 
AnswerRe: Play MKV files in embedded media player Pin
Bekjong8-Jun-07 2:32
Bekjong8-Jun-07 2:32 
GeneralRe: Play MKV files in embedded media player Pin
sypack8-Jun-07 2:37
sypack8-Jun-07 2:37 
QuestionEncryption and Decryption Pin
M. J. Jaya Chitra8-Jun-07 2:15
M. J. Jaya Chitra8-Jun-07 2:15 
AnswerRe: Encryption and Decryption Pin
Sathesh Sakthivel8-Jun-07 2:19
Sathesh Sakthivel8-Jun-07 2:19 
AnswerRe: Encryption and Decryption Pin
Pixinger778-Jun-07 3:10
Pixinger778-Jun-07 3:10 
GeneralRe: Encryption and Decryption Pin
originSH8-Jun-07 3:48
originSH8-Jun-07 3:48 
AnswerRe: Encryption and Decryption Pin
Russell Jones8-Jun-07 4:39
Russell Jones8-Jun-07 4:39 
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Security.Cryptography;<br />
<br />
namespace Helper.Crypto<br />
{<br />
   public class HashMethods<br />
   {<br />
      public static string GenerateSalt()<br />
      {<br />
         //Create 32 bytes of random data for use as  a salt<br />
         byte[] Salt = new byte[32];<br />
         RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();<br />
         rng.GetNonZeroBytes(Salt);<br />
         return Encoding.UTF8.GetString(Salt);<br />
      }<br />
      public static string Hash(string text,string saltString)<br />
      {<br />
         string SaltedString = text + saltString;<br />
         byte[] SaltedText =  Encoding.UTF8.GetBytes(SaltedString);<br />
         HashAlgorithm hash = new SHA512Managed();<br />
         byte[] hashBytes = hash.ComputeHash(SaltedText);<br />
         return Convert.ToBase64String(hashBytes);<br />
      }<br />
   }<br />
}


I store both the salt and the hashed PWD+Salt in a DB.
When a client tries to log in the server gives it the salt and the client adds the salt to the username and hashes. pass the hashed password up to the server and compare with the value stored in the DB.
This way you never know the user's password.

HTH

Russ
QuestionSQL Connection DialogBox Pin
ScottM18-Jun-07 2:07
ScottM18-Jun-07 2:07 
QuestionPacking a class into a byte array - would [Serializable] do the trick? Pin
Dewald8-Jun-07 2:02
Dewald8-Jun-07 2:02 
AnswerRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 2:16
AikinX8-Jun-07 2:16 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
Dewald8-Jun-07 2:38
Dewald8-Jun-07 2:38 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 3:27
AikinX8-Jun-07 3:27 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
Dewald8-Jun-07 3:37
Dewald8-Jun-07 3:37 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 4:08
AikinX8-Jun-07 4:08 
AnswerRe: Packing a class into a byte array - would [Serializable] do the trick? [modified] Pin
AikinX8-Jun-07 20:43
AikinX8-Jun-07 20:43 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 23:50
AikinX8-Jun-07 23:50 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
Dewald10-Jun-07 23:09
Dewald10-Jun-07 23:09 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX11-Jun-07 0:15
AikinX11-Jun-07 0:15 
QuestionNmericUpDown - set the Value outside the range. HELP!!! Pin
julgri8-Jun-07 1:40
julgri8-Jun-07 1:40 
AnswerRe: NmericUpDown - set the Value outside the range. HELP!!! Pin
Guffa8-Jun-07 1:46
Guffa8-Jun-07 1:46 
GeneralRe: NmericUpDown - set the Value outside the range. HELP!!! Pin
julgri8-Jun-07 6:42
julgri8-Jun-07 6:42 
GeneralRe: NmericUpDown - set the Value outside the range. HELP!!! Pin
Dave Kreskowiak8-Jun-07 6:47
mveDave Kreskowiak8-Jun-07 6:47 
GeneralRe: NmericUpDown - set the Value outside the range. HELP!!! Pin
julgri8-Jun-07 6:56
julgri8-Jun-07 6:56 
GeneralRe: NmericUpDown - set the Value outside the range. HELP!!! Pin
Dave Kreskowiak8-Jun-07 10:08
mveDave Kreskowiak8-Jun-07 10:08 

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.