Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > How to generate an MD5 data from the string

Reply
Thread Tools

How to generate an MD5 data from the string

 
 
Peter Afonin
Guest
Posts: n/a
 
      08-20-2004
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"))
_
& "a0107THOP: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


 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      08-20-2004
And the exact problem is (how do you convert) ?

I would suggest
http://msdn.microsoft.com/library/de...simplified.asp

Patrice
--

"Peter Afonin" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> 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"))
> _
> & "a0107THOP: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
>
>



 
Reply With Quote
 
 
 
 
Peter Afonin
Guest
Posts: n/a
 
      08-20-2004
Thank you, Patrice.

I'll try this, if it doesn't work I'll post my conversion here.

Peter

"Patrice" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> And the exact problem is (how do you convert) ?
>
> I would suggest
>

http://msdn.microsoft.com/library/de...simplified.asp
>
> Patrice
> --
>
> "Peter Afonin" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed)...
> > 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"))
> > _
> > & "a0107THOP: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
> >
> >

>
>



 
Reply With Quote
 
PL
Guest
Posts: n/a
 
      08-24-2004

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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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"))
> _
> & "a0107THOP: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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
create a md5 / md5 passwd with a salt Peter Woodsky Ruby 6 11-21-2008 09:08 AM
md5 from python different then md5 from command line ursache.marius@gmail.com Python 9 05-07-2006 11:49 PM
How to generate an MD5 data from the string Peter Afonin ASP .Net 3 08-24-2004 09:09 AM
I remember someone asking about an MD5 javascript: http://pajhome.org.uk/crypt/md5/ Mozzie ³ »\( òvó \)« Javascript 0 07-12-2004 01:06 PM



Advertisments