加密代码
Private Function JiaMi(ByVal No As String) As String
Dim Key, Pass As String
Dim i, code, j As Integer
Dim HashCryptoService As HashAlgorithm
HashCryptoService = New SHA256Managed
Dim bytIn As Byte() = UTF8Encoding.UTF8.GetBytes(No)
Dim bytOut As Byte() = HashCryptoService.ComputeHash(bytIn)
Key = Convert.ToBase64String(bytOut)
If Key.Length > 12 Then
Key = Key.Substring(0, 8)
End If
Key = Key.ToUpper()
For i = 0 To 7
code = AscW(Key.Substring(i, 1))
If code < 48 Then
j = code Mod 10
j = j + 48
Pass += ChrW(j)
ElseIf code < 57 Then
Pass += ChrW(code)
ElseIf code < 65 Then
j = code Mod 10
j = j + 65
Pass += ChrW(j)
ElseIf code < 90 Then
Pass += ChrW(code)
Else
j = code Mod 10
j = 90 - j
Pass += ChrW(j)
End If
Next
MsgBox(Pass, MsgBoxStyle.Information, "")
Return Pass
End Function
Dim Key, Pass As String
Dim i, code, j As Integer
Dim HashCryptoService As HashAlgorithm
HashCryptoService = New SHA256Managed
Dim bytIn As Byte() = UTF8Encoding.UTF8.GetBytes(No)
Dim bytOut As Byte() = HashCryptoService.ComputeHash(bytIn)
Key = Convert.ToBase64String(bytOut)
If Key.Length > 12 Then
Key = Key.Substring(0, 8)
End If
Key = Key.ToUpper()
For i = 0 To 7
code = AscW(Key.Substring(i, 1))
If code < 48 Then
j = code Mod 10
j = j + 48
Pass += ChrW(j)
ElseIf code < 57 Then
Pass += ChrW(code)
ElseIf code < 65 Then
j = code Mod 10
j = j + 65
Pass += ChrW(j)
ElseIf code < 90 Then
Pass += ChrW(code)
Else
j = code Mod 10
j = 90 - j
Pass += ChrW(j)
End If
Next
MsgBox(Pass, MsgBoxStyle.Information, "")
Return Pass
End Function