Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hey all
I want to convert a string to md5 like this
1234567890123475e8dd316726b0335 = 8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b

Thanks in advance
Please Help me
Posted
Comments
OriginalGriff 18-Jan-11 14:22pm    
See Daves' answer re MD5 security: I would recommend SHA512 (also built into .NET) over MD5 for all new applications.

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Jan-11 13:55pm    
Clear and to the point -- my 5. However, Inquirer should pay attention to a warning in the Answer by Dave; see also my comment.
Nish Nishant 18-Jan-11 13:59pm    
Thanks.
MD5 is known to be weak and easily cracked. You may want to reconsider using it if security of data is a real issue.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Jan-11 13:53pm    
Dave, you're absolutely right if you mean security or ciphering. In this case, I would advice RSA; I would advice to use strong names for all assemblies, etc.
But we don't know the purpose: this is merely some hash code; a check sums of this kind are often published with the downloads (not so secure, but this can be a requirement), or whatever else.
OriginalGriff 18-Jan-11 14:19pm    
RSA isn't really suitable as a replacement for MD5: the latter is a hashing algorithm (i.e. one way, you can't regenerate the input from the output) while RSA is a public key encryption system.
If you are storing login passwords for example, RSA is decidedly not suitable.
MD5 is indeed classed as "broken" and I have been recommending SHA512 ever since the announcement (SHA1024 is due in 2012 and should be considerably better). SHA is a hashing algorithm and as such is more suitable for MD5 type applications than a reversible encryption technique.
Unfortunately, I can't give you a five, because your comment did deserve it!
Sergey Alexandrovich Kryukov 18-Jan-11 15:39pm    
Griff, thanks for your note. My main point was exactly this: I say, may be MD5 is good enough for the purpose which we don't know exactly. About RSA the purpose was to mention it's important for security, so I would recommend it where appropriate.
Thank you for your assessment of SHA as opposed to MD5: I did not have clear idea on their comparison.
Dave Kreskowiak 18-Jan-11 19:11pm    
Your correct. I have no idea what he's using this for. But, an educated guess would be for passwords since he's asking about encrypting a string and his example is for a relatively short string. I could very well be wrong too. But, in either case, something that's worth hashing is worth more than a broken hash, no matter what it is. I'd user SHA512 in it's place, for now...
OriginalGriff 18-Jan-11 14:21pm    
Good advice, I have been recommending SHA512 for a year or so now. +5
This is what i used and worked
try it
Dim md5 As MD5 = System.Security.Cryptography.MD5.Create()
Dim inputBytes As Byte() = System.Text.Encoding.ASCII.GetBytes("1234567890123475e8dd316726b0335")
Dim hash As Byte() = md5.ComputeHash(inputBytes)
Dim sb As New StringBuilder()
For i As Integer = 0 To hash.Length - 1
    sb.Append(hash(i).ToString("x2"))
Next
TextBox1.Text = sb.ToString


Hope i helped
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900