Foxtable(狐表)用户栏目专家坐堂 → 关于快递API中的MD5加密的问题


  共有2313人关注过本帖树形打印复制链接

主题:关于快递API中的MD5加密的问题

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107440 积分:546479 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/7/2 8:33:00 [显示全部帖子]

写全命名空间

Public Function GetMd5(ByVal md5str As String, ByVal Type As Integer) As String
    If Type = 16 Then
        Dim algorithm As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()
        Dim data As Byte() = algorithm.ComputeHash(Encoding.UTF8.GetBytes(md5str))
        Dim sh1 As String = ""

        For i As Integer = 0 To data.Length - 1
            sh1 += data(i).ToString("x2").ToUpperInvariant()
        Next
        Return sh1.Substring(8, 16).ToLower()
    ElseIf Type = 32 Then
        Dim algorithm As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()
        Dim data As Byte() = algorithm.ComputeHash(Encoding.UTF8.GetBytes(md5str))
        Dim sh1 As String = ""

        For i As Integer = 0 To data.Length - 1
            sh1 += data(i).ToString("x2").ToUpperInvariant()
        Next

        Return sh1.ToLower()
    End If

    Return ""
End Function

 回到顶部