Converter Códito

Tenho o um código em VB6, tentei alguns conversores de VB6 Online e não tive sucesso. Alguém que conheça VB6 e C# poderia me dar uma ajuda e fazer a tradução para mim de VB6 para C#:

Preciso dele em C# para validar uns usuários que estão com este cálculo:

Function MD5AB2Hash(ByVal hashthis As String) As String
		ReDim buf(0 To 3) As String
		ReDim in_(0 To 15) As String
		Dim tempnum As Integer, tempnum2 As Integer, loopit As Integer, loopouter As Integer, loopinner As Integer
		Dim A As String, b As String, c As String, D As String

		' Add padding
		tempnum = 8 * Len(hashthis)
		hashthis = hashthis + Chr$(128) 'Add binary 10000000
		tempnum2 = 56 - Len(hashthis) Mod 64
		If tempnum2 < 0 Then
			tempnum2 = 64 + tempnum2
		End If
		hashthis = hashthis + String$(tempnum2, Chr$(0))
		For loopit = 1 To 8
			hashthis = hashthis + Chr$(tempnum Mod 256)
			tempnum = tempnum - tempnum Mod 256
			tempnum = tempnum / 256
		Next loopit
		
		' Set magic numbers
		buf(0) = "67452301"
		buf(1) = "efcdab89"
		buf(2) = "98badcfe"
		buf(3) = "10325476"
		
		' For each 512 bit section
		For loopouter = 0 To Len(hashthis) / 64 - 1
			A = buf(0)
			b = buf(1)
			c = buf(2)
			D = buf(3)
		
			' Get the 512 bits
			For loopit = 0 To 15
				in_(loopit) = ""
				For loopinner = 1 To 4
					in_(loopit) = Hex$(Asc(Mid$(hashthis, 64 * loopouter + 4 * loopit + loopinner, 1))) + in_(loopit)
					If Len(in_(loopit)) Mod 2 Then in_(loopit) = "0" + in_(loopit)
				Next loopinner
			Next loopit
			
			' Round 1
			MD5AB2F1 A, b, c, D, in_(0), "d76aa478", 7
			MD5AB2F1 D, A, b, c, in_(1), "e8c7b756", 12
			MD5AB2F1 c, D, A, b, in_(2), "242070db", 17
			MD5AB2F1 b, c, D, A, in_(3), "c1bdceee", 22
			MD5AB2F1 A, b, c, D, in_(4), "f57c0faf", 7
			MD5AB2F1 D, A, b, c, in_(5), "4787c62a", 12
			MD5AB2F1 c, D, A, b, in_(6), "a8304613", 17
			MD5AB2F1 b, c, D, A, in_(7), "fd469501", 22
			MD5AB2F1 A, b, c, D, in_(8), "698098d8", 7
			MD5AB2F1 D, A, b, c, in_(9), "8b44f7af", 12
			MD5AB2F1 c, D, A, b, in_(10), "ffff5bb1", 17
			MD5AB2F1 b, c, D, A, in_(11), "895cd7be", 22
			MD5AB2F1 A, b, c, D, in_(12), "6b901122", 7
			MD5AB2F1 D, A, b, c, in_(13), "fd987193", 12
			MD5AB2F1 c, D, A, b, in_(14), "a679438e", 17
			MD5AB2F1 b, c, D, A, in_(15), "49b40821", 22
			
			' Round 2
			MD5AB2F2 A, b, c, D, in_(1), "f61e2562", 5
			MD5AB2F2 D, A, b, c, in_(6), "c040b340", 9
			MD5AB2F2 c, D, A, b, in_(11), "265e5a51", 14
			MD5AB2F2 b, c, D, A, in_(0), "e9b6c7aa", 20
			MD5AB2F2 A, b, c, D, in_(5), "d62f105d", 5
			MD5AB2F2 D, A, b, c, in_(10), "02441453", 9
			MD5AB2F2 c, D, A, b, in_(15), "d8a1e681", 14
			MD5AB2F2 b, c, D, A, in_(4), "e7d3fbc8", 20
			MD5AB2F2 A, b, c, D, in_(9), "21e1cde6", 5
			MD5AB2F2 D, A, b, c, in_(14), "c33707d6", 9
			MD5AB2F2 c, D, A, b, in_(3), "f4d50d87", 14
			MD5AB2F2 b, c, D, A, in_(8), "455a14ed", 20
			MD5AB2F2 A, b, c, D, in_(13), "a9e3e905", 5
			MD5AB2F2 D, A, b, c, in_(2), "fcefa3f8", 9
			MD5AB2F2 c, D, A, b, in_(7), "676f02d9", 14
			MD5AB2F2 b, c, D, A, in_(12), "8d2a4c8a", 20
			
			' Round 3
			MD5AB2F3 A, b, c, D, in_(5), "fffa3942", 4
			MD5AB2F3 D, A, b, c, in_(8), "8771f681", 11
			MD5AB2F3 c, D, A, b, in_(11), "6d9d6122", 16
			MD5AB2F3 b, c, D, A, in_(14), "fde5380c", 23
			MD5AB2F3 A, b, c, D, in_(1), "a4beea44", 4
			MD5AB2F3 D, A, b, c, in_(4), "4bdecfa9", 11
			MD5AB2F3 c, D, A, b, in_(7), "f6bb4b60", 16
			MD5AB2F3 b, c, D, A, in_(10), "bebfbc70", 23
			MD5AB2F3 A, b, c, D, in_(13), "289b7ec6", 4
			MD5AB2F3 D, A, b, c, in_(0), "eaa127fa", 11
			MD5AB2F3 c, D, A, b, in_(3), "d4ef3085", 16
			MD5AB2F3 b, c, D, A, in_(6), "04881d05", 23
			MD5AB2F3 A, b, c, D, in_(9), "d9d4d039", 4
			MD5AB2F3 D, A, b, c, in_(12), "e6db99e5", 11
			MD5AB2F3 c, D, A, b, in_(15), "1fa27cf8", 16
			MD5AB2F3 b, c, D, A, in_(2), "c4ac5665", 23
			
			' Round 4
			MD5AB2F4 A, b, c, D, in_(0), "f4292244", 6
			MD5AB2F4 D, A, b, c, in_(7), "432aff97", 10
			MD5AB2F4 c, D, A, b, in_(14), "ab9423a7", 15
			MD5AB2F4 b, c, D, A, in_(5), "fc93a039", 21
			MD5AB2F4 A, b, c, D, in_(12), "655b59c3", 6
			MD5AB2F4 D, A, b, c, in_(3), "8f0ccc92", 10
			MD5AB2F4 c, D, A, b, in_(10), "ffeff47d", 15
			MD5AB2F4 b, c, D, A, in_(1), "85845dd1", 21
			MD5AB2F4 A, b, c, D, in_(8), "6fa87e4f", 6
			MD5AB2F4 D, A, b, c, in_(15), "fe2ce6e0", 10
			MD5AB2F4 c, D, A, b, in_(6), "a3014314", 15
			MD5AB2F4 b, c, D, A, in_(13), "4e0811a1", 21
			MD5AB2F4 A, b, c, D, in_(4), "f7537e82", 6
			MD5AB2F4 D, A, b, c, in_(11), "bd3af235", 10
			MD5AB2F4 c, D, A, b, in_(2), "2ad7d2bb", 15
			MD5AB2F4 b, c, D, A, in_(9), "eb86d391", 21
		
			buf(0) = BigAA2Add(buf(0), A)
			buf(1) = BigAA2Add(buf(1), b)
			buf(2) = BigAA2Add(buf(2), c)
			buf(3) = BigAA2Add(buf(3), D)
		Next loopouter
		
		' Extract MD5Hash
		hashthis = ""
		For loopit = 0 To 3
			For loopinner = 3 To 0 Step -1
				hashthis = hashthis + Mid$(buf(loopit), 1 + 2 * loopinner, 2)
			Next loopinner
		Next loopit
		
		' And return it
		MD5AB2Hash = hashthis

End Function

Vai ser bem complicado usar esse código!, porque, você não usa algum código correspondente em C#, bem o que esse código em VB6 faz? e o que você precisa?

O que acontece é que existe um programa em que as senhas foram mudadas e colocadas desta forma., usando na verdade esta “criptografia”. Eu não conheceu bem (ou nem mal o VB)

Complicado pelo que eu vi, não existe todas as funções em C# ou tem que ser trabalhadas talvez de outra forma!

pensei em exportar como dll, mas o vb não será mais continuado, então n sei como vai ficar… talvez daqui um tempo pare de funcionar fora…