Click here to Skip to main content
15,921,113 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: what is the problem with this code Pin
Dave Kreskowiak13-Jul-07 3:31
mveDave Kreskowiak13-Jul-07 3:31 
AnswerRe: what is the problem with this code Pin
Paul Conrad13-Jul-07 4:32
professionalPaul Conrad13-Jul-07 4:32 
QuestionWhy can't i catch parameter Pin
boyindie12-Jul-07 23:10
boyindie12-Jul-07 23:10 
AnswerRe: Why can't i catch parameter Pin
Guffa12-Jul-07 23:40
Guffa12-Jul-07 23:40 
GeneralRe: Why can't i catch parameter Pin
boyindie12-Jul-07 23:47
boyindie12-Jul-07 23:47 
GeneralRe: Why can't i catch parameter Pin
Dave Kreskowiak13-Jul-07 2:45
mveDave Kreskowiak13-Jul-07 2:45 
GeneralRe: Why can't i catch parameter Pin
boyindie13-Jul-07 2:56
boyindie13-Jul-07 2:56 
GeneralRe: Why can't i catch parameter Pin
boyindie13-Jul-07 3:05
boyindie13-Jul-07 3:05 
this is the code that i use to create the salt

Dim shaHash As New System.Security.Cryptography.SHA384Managed()


Dim hashedBytes As Byte()

Dim encoder As New UTF8Encoding()

Dim data() As Byte
data = New Byte(6) {}
Dim rng As New RNGCryptoServiceProvider
rng.GetBytes(data)

Dim PSalt As String = encoder.GetString(data)
MsgBox(PSalt)

i then do the following to encrypt my password and i just pass the psalt variable into my salt field in database

hashedBytes = shaHash.ComputeHash(encoder.GetBytes(txtPassword.Text & PSalt))
Dim PWhash As String = encoder.GetString(hashedBytes)

param = cmdString.Parameters.Add("?p_Password", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = PWhash
MsgBox(PWhash)

to log in I have the following function which gets my salt

cmdStringS.CommandText = "sp_getSalt"
cmdStringS.CommandType = CommandType.StoredProcedure

Dim literr As New LiteralControl

Dim param As MySqlParameter
Try

param = cmdStringS.Parameters.Add("?p_username", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtUserName.Text

param = cmdStringS.Parameters.Add("?p_salt", MySqlDbType.VarChar)
cmdStringS.Parameters("?p_salt").Direction = ParameterDirection.Output

connection.Open()
cmdStringS.ExecuteScalar()
connection.Close()

Catch ex As Exception
literr.Text = ex.Message
MsgBox(ex.Message)

End Try
Dim salted As String = cmdStringS.Parameters("?p_salt").Value
sendData(sender, e, cmdStringS, salted)

I then pass salted variable to my data submit method, where i do the followin wit the password and hash

hashedBytes = shaHash.ComputeHash(encoder.GetBytes(txtPassword.Text & salted))
Dim PWhash As String = encoder.GetString(hashedBytes)
param = cmdString.Parameters.Add("?p_Password", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = PWhash


GeneralRe: Why can't i catch parameter Pin
Dave Kreskowiak13-Jul-07 5:51
mveDave Kreskowiak13-Jul-07 5:51 
AnswerRe: Why can't i catch parameter Pin
Guffa13-Jul-07 6:03
Guffa13-Jul-07 6:03 
GeneralRe: Why can't i catch parameter Pin
boyindie16-Jul-07 4:33
boyindie16-Jul-07 4:33 
GeneralRe: Why can't i catch parameter Pin
Guffa16-Jul-07 12:15
Guffa16-Jul-07 12:15 
GeneralRe: Why can't i catch parameter Pin
boyindie16-Jul-07 12:18
boyindie16-Jul-07 12:18 
QuestionMy own equalizer Pin
bala_kathir12-Jul-07 21:20
bala_kathir12-Jul-07 21:20 
AnswerRe: My own equalizer Pin
Dave Kreskowiak13-Jul-07 2:41
mveDave Kreskowiak13-Jul-07 2:41 
Questiondisable back and forward button Pin
Ashish Kumar Vyas12-Jul-07 18:49
Ashish Kumar Vyas12-Jul-07 18:49 
AnswerRe: disable back and forward button Pin
Sathesh Sakthivel12-Jul-07 19:18
Sathesh Sakthivel12-Jul-07 19:18 
GeneralRe: disable back and forward button Pin
Dave Kreskowiak13-Jul-07 2:38
mveDave Kreskowiak13-Jul-07 2:38 
AnswerRe: disable back and forward button Pin
RepliCrux12-Jul-07 20:06
RepliCrux12-Jul-07 20:06 
GeneralRe: disable back and forward button Pin
Ashish Kumar Vyas12-Jul-07 23:37
Ashish Kumar Vyas12-Jul-07 23:37 
GeneralRe: disable back and forward button Pin
Vasudevan Deepak Kumar13-Jul-07 0:06
Vasudevan Deepak Kumar13-Jul-07 0:06 
Questionerror when commiting the row to the original data store(urgent) Pin
cutequencher12-Jul-07 16:49
cutequencher12-Jul-07 16:49 
AnswerRe: error when commiting the row to the original data store(urgent) Pin
Christian Graus12-Jul-07 17:09
protectorChristian Graus12-Jul-07 17:09 
GeneralRe: error when commiting the row to the original data store(urgent) Pin
cutequencher12-Jul-07 17:50
cutequencher12-Jul-07 17:50 
QuestionToggle Button in ToolStrip Pin
MadmanWoo12-Jul-07 13:13
MadmanWoo12-Jul-07 13:13 

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.