# Explain this statement, algorithm

Page 1 of 1

## 2 Replies - 431 Views - Last Post: 07 December 2012 - 08:52 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=303168&amp;s=183f1b55526a56a3c8d7314ae008a77e&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 7umper

Reputation: 0
• Posts: 27
• Joined: 29-April 12

# Explain this statement, algorithm

Posted 07 December 2012 - 08:28 PM

Hi! all.
I need to make a login form with an encrytped data(user or pass), so I google for many time and found a fucntion.
But the problem is I dont understand the algorithm of each statement. Could you all explain to me?

```    Private Function StringtoMD5(ByVal Content As String) As String
Dim M5 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim ByteString() As Byte = System.Text.Encoding.ASCII.GetBytes(Content)
ByteString = M5.ComputeHash(ByteString)
Dim FinalString As String = Nothing
For Each bt As Byte In ByteString
FinalString &= bt.ToString("x2")
Next
Return FinalString.ToUpper()
End Function
```

New programmer
7umper (Nuii)

Is This A Good Question/Topic? 0

## Replies To: Explain this statement, algorithm

### #2 modi123_1

• Suitor #2

Reputation: 11614
• Posts: 45,779
• Joined: 12-June 08

## Re: Explain this statement, algorithm

Posted 07 December 2012 - 08:39 PM

line 2 - variable m4 is a MD5CryptoServiceProvider
line 3 - variable ByteString is a byte array that is filled with the variable 'Content' 's value converted to an array of bytes.
Line 4 - byte array 'ByteString' gets the hash of itself.
Line 5 - create an empty string called 'finalstring'.
Line 6 - for each byte in the byte array 'ByteString'
Line 7 - concatenate 'finalstring' the current byte after being string formatted X2 (a hexadecimal format)
Line 8 - go to the next byte
Line 9 - return the variable 'finalstring' in upper case.

http://msdn.microsof...v=vs.95%29.aspx
http://msdn.microsof...ding.ascii.aspx
http://msdn.microsof...ceprovider.aspx

### #3 7umper

Reputation: 0
• Posts: 27
• Joined: 29-April 12

## Re: Explain this statement, algorithm

Posted 07 December 2012 - 08:52 PM

modi123_1, on 08 December 2012 - 10:39 AM, said:

line 2 - variable m4 is a MD5CryptoServiceProvider
line 3 - variable ByteString is a byte array that is filled with the variable 'Content' 's value converted to an array of bytes.
Line 4 - byte array 'ByteString' gets the hash of itself.
Line 5 - create an empty string called 'finalstring'.
Line 6 - for each byte in the byte array 'ByteString'
Line 7 - concatenate 'finalstring' the current byte after being string formatted X2 (a hexadecimal format)
Line 8 - go to the next byte
Line 9 - return the variable 'finalstring' in upper case.

http://msdn.microsof...v=vs.95%29.aspx
http://msdn.microsof...ding.ascii.aspx
http://msdn.microsof...ceprovider.aspx

Thanks modi123_1. I just want to understand deeply before I code a program.