MySql';vb.net中的s函数旧密码?
我需要这个函数来创建查询第三方SOAP提供者的质询密码 我在c#中找到了这个解决方案: 但将其翻译成vb.net似乎远远超出了我的技能水平 我的其他选择是:MySql';vb.net中的s函数旧密码?,.net,vb.net,.net,Vb.net,我需要这个函数来创建查询第三方SOAP提供者的质询密码 我在c#中找到了这个解决方案: 但将其翻译成vb.net似乎远远超出了我的技能水平 我的其他选择是: 仅使用此函数在c#中创建dll 每次我需要使用这个函数时都可以查询MySQL 所有这些似乎都够糟糕的了。如果有人能提供任何帮助,我们将不胜感激。公共函数mysql\u old\u密码(sPassword作为字符串)作为字符串 Public Function mysql_old_password(sPassword As String
- 仅使用此函数在c#中创建dll
- 每次我需要使用这个函数时都可以查询MySQL
公共函数mysql\u old\u密码(sPassword作为字符串)作为字符串
Public Function mysql_old_password(sPassword As String) As String
Dim result As UInt32() = New UInt32(1) {}
Dim nr As UInt32 = 1345345333, add As UInt32 = 7, nr2 As UInt32 = &H12345671
Dim tmp As UInt32
Dim password As Char() = sPassword.ToCharArray()
Dim i As Int32
For i = 0 To sPassword.Length - 1
If password(i) = " "c OrElse password(i) = ControlChars.Tab Then
Continue For
End If
tmp = AscW(password(i))
nr = nr Xor (((nr And 63) + add) * tmp) + (nr << 8)
On Error GoTo 0
nr2 += (nr2 << 8) Xor nr
add += tmp
Next
Dim one As UInt32 = 1
result(0) = nr And ((one << 31) - 1)
Dim val As UInt32 = ((one << 31) - 1)
result(1) = nr2 And val
Dim hash As String = [String].Format("{0:X}{1:X}", result(0), result(1))
Return hash.ToLower()
End Function
Dim结果为UInt32()=新UInt32(1){}
尺寸编号为UInt32=1345345333,添加为UInt32=7,nr2为UInt32=&H12345671
将tmp调暗为UInt32
Dim密码为Char()=sPassword.ToCharArray()
Dim i As Int32
对于i=0到sPassword.Length-1
如果密码(i)=“c或LSE密码(i)=控制字符选项卡,则
继续
如果结束
tmp=AscW(密码(i))
nr=nr Xor(((nr和63)+add)*tmp)+(nr有效,谢谢!只需补充说明:VB.net中有一个OverflowException,但在c#等价物中没有…这篇文章提出了一个解决方案=>。我做了打开“移除整数溢出检查”属性。这是一个项目范围内的设置。
,它的工作方式很有魅力。