compose sample
[mono.git] / mcs / mbas / testsuite / TestUtils.vb
1 Imports System\r
2 Imports System.Text\r
3 Imports System.Security.Cryptography\r
4 \r
5 Public Module TestUtils\r
6 \r
7 Public Function GenerateHash(ByVal SourceText As String) As String\r
8         'Create an encoding object to ensure the encoding standard for the source text\r
9         Dim Ue As New UnicodeEncoding()\r
10         \r
11         'Retrieve a byte array based on the source text\r
12         Dim ByteSourceText() As Byte = Ue.GetBytes(SourceText)\r
13         \r
14         'Instantiate an MD5 Provider object\r
15         Dim Md5 As New MD5CryptoServiceProvider()\r
16         \r
17         'Compute the hash value from the source\r
18         Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)\r
19         \r
20         'And convert it to String format for return\r
21         Return Convert.ToBase64String(ByteHash)\r
22 End Function\r
23 \r
24 End Module\r