Ask a Question related to ASP.NET Security, Design and Development.
-
Peter Afonin #1
How to generate an MD5 data from the string
Hello,
I've never been dealing with the security before. Could you please help me
to write a code to generate an MD5 data from a string? I've been using this
example from MSDN:
Function MD5hash(data() As Byte) As Byte()
' This is one implementation of the abstract class MD5.
Dim md5 As New MD5CryptoServiceProvider()
Dim result As Byte() = md5.ComputeHash(data)
Return result
End Function
but perhaps made a mistake converting string to byte and couldn't fix it.
My string looks like this:
sCRC = "avp:" & dblSum.ToString & ":" & CLng(Format(Now, "yyyyMMddHHmmss"))
_
& ":pa0107THOP:shp_UserID=" & sUser _
& ":shp_Price=" & dblPrice.ToString & ":shp_PaymentNo=" _
& CLng(Format(Now, "yyyyMMddHHmmss")) & ":shp_Term=" _
& sTerm & ":shp_Email=" & sEmail
I will be passing this parameter as a querystring.
I would really appreciate your help.
Thank you,
--
Peter Afonin
Peter Afonin Guest
-
How to add a space to string data in datagrid
hi Gurus, How to add a space to string data using the dataformatstring property ? Is there any other way to do it. Shreyas -
ASP Code to generate the schema of an SQL Table (field name, Data types , Size)
Anyone has this SQL STATEMENT to traverse the User defined tables? I just need the Select Statement to get this info the rest I can handle. I... -
Adding pwd to data connection string
Hi can anyone tell me how to add a password to using this connection string pls <% set conn = server.createobject ("ADODB.connection")... -
How to generate an invoice from data
I need to be able to generate an invoice from an ASP page. Currently, the invoice is drawn in a web page and my client prints the page from their... -
Data Base connection string management
This is the same way I handle my connection strings except I usually add the ASPNET account into my SQL server and use Windows authentication so I... -
Patrice #2
Re: How to generate an MD5 data from the string
And the exact problem is (how do you convert) ?
I would suggest
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/cryptosimplified.asp[/url]
Patrice
--
"Peter Afonin" <pva@speakeasy.net> a écrit dans le message de
news:OBsIoDnhEHA.1568@TK2MSFTNGP09.phx.gbl...this> Hello,
>
> I've never been dealing with the security before. Could you please help me
> to write a code to generate an MD5 data from a string? I've been using"yyyyMMddHHmmss"))> example from MSDN:
>
> Function MD5hash(data() As Byte) As Byte()
> ' This is one implementation of the abstract class MD5.
> Dim md5 As New MD5CryptoServiceProvider()
>
> Dim result As Byte() = md5.ComputeHash(data)
>
> Return result
> End Function
>
> but perhaps made a mistake converting string to byte and couldn't fix it.
>
> My string looks like this:
>
> sCRC = "avp:" & dblSum.ToString & ":" & CLng(Format(Now,> _
> & ":pa0107THOP:shp_UserID=" & sUser _
> & ":shp_Price=" & dblPrice.ToString & ":shp_PaymentNo=" _
> & CLng(Format(Now, "yyyyMMddHHmmss")) & ":shp_Term=" _
> & sTerm & ":shp_Email=" & sEmail
>
> I will be passing this parameter as a querystring.
>
> I would really appreciate your help.
>
> Thank you,
>
> --
> Peter Afonin
>
>
Patrice Guest
-
Peter Afonin #3
Re: How to generate an MD5 data from the string
Thank you, Patrice.
I'll try this, if it doesn't work I'll post my conversion here.
Peter
"Patrice" <nobody@nowhere.com> wrote in message
news:OL9PaRqhEHA.712@TK2MSFTNGP09.phx.gbl...[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/cryptosimplified.asp[/url]> And the exact problem is (how do you convert) ?
>
> I would suggest
>me>
> Patrice
> --
>
> "Peter Afonin" <pva@speakeasy.net> a écrit dans le message de
> news:OBsIoDnhEHA.1568@TK2MSFTNGP09.phx.gbl...> > Hello,
> >
> > I've never been dealing with the security before. Could you please helpit.> this> > to write a code to generate an MD5 data from a string? I've been using> > example from MSDN:
> >
> > Function MD5hash(data() As Byte) As Byte()
> > ' This is one implementation of the abstract class MD5.
> > Dim md5 As New MD5CryptoServiceProvider()
> >
> > Dim result As Byte() = md5.ComputeHash(data)
> >
> > Return result
> > End Function
> >
> > but perhaps made a mistake converting string to byte and couldn't fix> "yyyyMMddHHmmss"))> >
> > My string looks like this:
> >
> > sCRC = "avp:" & dblSum.ToString & ":" & CLng(Format(Now,>> > _
> > & ":pa0107THOP:shp_UserID=" & sUser _
> > & ":shp_Price=" & dblPrice.ToString & ":shp_PaymentNo=" _
> > & CLng(Format(Now, "yyyyMMddHHmmss")) & ":shp_Term=" _
> > & sTerm & ":shp_Email=" & sEmail
> >
> > I will be passing this parameter as a querystring.
> >
> > I would really appreciate your help.
> >
> > Thank you,
> >
> > --
> > Peter Afonin
> >
> >
>
Peter Afonin Guest
-
PL #4
Re: How to generate an MD5 data from the string
The absolute simplest way is to use:
string md5= System.Web.Security.FormsAuthentication.HashPasswo rdForStoringInConfigFile( str,"MD5");
where str is your string you want to computer the hash from and the last argument can
be "MD5" or "SHA1"
For more info look this up in the docs.
PL.
"Peter Afonin" <pva@speakeasy.net> wrote in message news:OBsIoDnhEHA.1568@TK2MSFTNGP09.phx.gbl...> Hello,
>
> I've never been dealing with the security before. Could you please help me
> to write a code to generate an MD5 data from a string? I've been using this
> example from MSDN:
>
> Function MD5hash(data() As Byte) As Byte()
> ' This is one implementation of the abstract class MD5.
> Dim md5 As New MD5CryptoServiceProvider()
>
> Dim result As Byte() = md5.ComputeHash(data)
>
> Return result
> End Function
>
> but perhaps made a mistake converting string to byte and couldn't fix it.
>
> My string looks like this:
>
> sCRC = "avp:" & dblSum.ToString & ":" & CLng(Format(Now, "yyyyMMddHHmmss"))
> _
> & ":pa0107THOP:shp_UserID=" & sUser _
> & ":shp_Price=" & dblPrice.ToString & ":shp_PaymentNo=" _
> & CLng(Format(Now, "yyyyMMddHHmmss")) & ":shp_Term=" _
> & sTerm & ":shp_Email=" & sEmail
>
> I will be passing this parameter as a querystring.
>
> I would really appreciate your help.
>
> Thank you,
>
> --
> Peter Afonin
>
>
PL Guest



Reply With Quote

