Saturday, March 24, 2012

MD5 Encryption

I need to create an MD5 encrypted variable to be passed to another web
technology.
the receiving end will take care of itself. However, i can't figure out how
to generate a simple hash value in asp.net VB
here is what i want to do:
given this string "hello"
create a hash value (MD5) and use a response.write to display it on screen.
that is all.
I've seen a few articals but i am looking for a simple example. I really
appreciate the help,
Thanks
KES
--
Share The Knowledge. I need all the help I can get and so do you!Fairly sure this snippet still works- dont know where it came from!
private string getHash(string Value)
{
System.Security.Cryptography.MD5CryptoServiceProvider sec = new
System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] encodedData = System.Text.Encoding.ASCII.GetBytes(Value);
encodedData = sec.ComputeHash(encodedData);
string retVal = "";
for (int i=0; i < encodedData.Length; i++)
retVal += encodedData[i].ToString("x2").ToLower();
return retVal;
}
Regards
John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Yankee Imperialist Dog" <YankeeImperialistDog@.discussions.microsoft.com>
wrote in message news:FE4C4B2E-7CD9-4287-87C6-78EB21CB4FF2@.microsoft.com...
>I need to create an MD5 encrypted variable to be passed to another web
> technology.
> the receiving end will take care of itself. However, i can't figure out
> how
> to generate a simple hash value in asp.net VB
> here is what i want to do:
> given this string "hello"
> create a hash value (MD5) and use a response.write to display it on
> screen.
> that is all.
> I've seen a few articals but i am looking for a simple example. I really
> appreciate the help,
> Thanks
> KES
> --
> Share The Knowledge. I need all the help I can get and so do you!
I've posted a VB.NET example of the MD5 hashing syntax here:
http://SteveOrr.net/faq/encrypt.aspx
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Yankee Imperialist Dog" <YankeeImperialistDog@.discussions.microsoft.com>
wrote in message news:FE4C4B2E-7CD9-4287-87C6-78EB21CB4FF2@.microsoft.com...
>I need to create an MD5 encrypted variable to be passed to another web
> technology.
> the receiving end will take care of itself. However, i can't figure out
> how
> to generate a simple hash value in asp.net VB
> here is what i want to do:
> given this string "hello"
> create a hash value (MD5) and use a response.write to display it on
> screen.
> that is all.
> I've seen a few articals but i am looking for a simple example. I really
> appreciate the help,
> Thanks
> KES
> --
> Share The Knowledge. I need all the help I can get and so do you!
Thank You, Having a bad day i guess.
The example is what i needed as is the one from John.
You're both fine Americans!
Share The Knowledge. I need all the help I can get and so do you!
"Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:

> I've posted a VB.NET example of the MD5 hashing syntax here:
> http://SteveOrr.net/faq/encrypt.aspx
> --
> I hope this helps,
> Steve C. Orr,
> MCSD, MVP, CSM, ASPInsider
> http://SteveOrr.net
>
> "Yankee Imperialist Dog" <YankeeImperialistDog@.discussions.microsoft.com>
> wrote in message news:FE4C4B2E-7CD9-4287-87C6-78EB21CB4FF2@.microsoft.com..
.
>
Thank You, Having a bad day i guess.
The example is what i needed as is the one from Steve
Share The Knowledge. I need all the help I can get and so do you!
"John Timney (MVP)" wrote:

> Fairly sure this snippet still works- dont know where it came from!
> private string getHash(string Value)
> {
> System.Security.Cryptography.MD5CryptoServiceProvider sec = new
> System.Security.Cryptography.MD5CryptoServiceProvider();
> byte[] encodedData = System.Text.Encoding.ASCII.GetBytes(Value);
> encodedData = sec.ComputeHash(encodedData);
> string retVal = "";
> for (int i=0; i < encodedData.Length; i++)
> retVal += encodedData[i].ToString("x2").ToLower();
> return retVal;
> }
> Regards
> John Timney (MVP)
> http://www.johntimney.com
> http://www.johntimney.com/blog
>
> "Yankee Imperialist Dog" <YankeeImperialistDog@.discussions.microsoft.com>
> wrote in message news:FE4C4B2E-7CD9-4287-87C6-78EB21CB4FF2@.microsoft.com..
.
>
>
Except that I'm English - but thats OK! LOL!
Regards
John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Yankee Imperialist Dog" <YankeeImperialistDog@.discussions.microsoft.com>
wrote in message news:9C09CE13-C856-495B-BF04-CAF70174E4E2@.microsoft.com...
> Thank You, Having a bad day i guess.
> The example is what i needed as is the one from John.
> You're both fine Americans!
> --
> Share The Knowledge. I need all the help I can get and so do you!
>
> "Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:
>
Hey the Bit's are !!! Any citizen of a country that can come up with Dr.
Who (Tom Baker), the Prisoner, Rock Follies, and, not to mention Viz Mag. is
equal to any ultra consertive Imperialist such as myself!
so i say again: Your a fine American!!!
:-) (lets hope we can all take a joke, lifes too short!)
--
Share The Knowledge. I need all the help I can get and so do you!
"John Timney (MVP)" wrote:

> Except that I'm English - but thats OK! LOL!
> Regards
> John Timney (MVP)
> http://www.johntimney.com
> http://www.johntimney.com/blog
>
> "Yankee Imperialist Dog" <YankeeImperialistDog@.discussions.microsoft.com>
> wrote in message news:9C09CE13-C856-495B-BF04-CAF70174E4E2@.microsoft.com..
.
>
>

0 comments:

Post a Comment