精华内容
下载资源
问答
  • VB中使用MD5对字符串加密

    千次阅读 2006-08-08 11:57:00
    1、在VB工程中添加类模块。“Project”-> “Add Class Module”。2、类模块源码如下:Option Explicit Visual Basic MD5 Implementation Robert Hubley and David Midkiff (mdj2023@hotmail.com) modify by ...

    1、在VB工程中添加类模块。“Project”-> “Add Class Module”。

    2、类模块源码如下:

    Option Explicit

    ' Visual Basic MD5 Implementation
    ' Robert Hubley and David Midkiff (mdj2023@hotmail.com)
    ' modify by simonyan, Support chinese
    ' Standard MD5 implementation optimised for the Visual Basic environment.
    ' Conforms to all standards and can be used in digital signature or password
    ' protection related schemes.

    Private Const OFFSET_4 = 4294967296#
    Private Const MAXINT_4 = 2147483647
    Private State(4) As Long
    Private ByteCounter As Long
    Private ByteBuffer(63) As Byte
    Private Const S11 = 7
    Private Const S12 = 12
    Private Const S13 = 17
    Private Const S14 = 22
    Private Const S21 = 5
    Private Const S22 = 9
    Private Const S23 = 14
    Private Const S24 = 20
    Private Const S31 = 4
    Private Const S32 = 11
    Private Const S33 = 16
    Private Const S34 = 23
    Private Const S41 = 6
    Private Const S42 = 10
    Private Const S43 = 15
    Private Const S44 = 21
    Property Get RegisterA() As String
        RegisterA = State(1)
    End Property
    Property Get RegisterB() As String
        RegisterB = State(2)
    End Property

    Property Get RegisterC() As String
        RegisterC = State(3)
    End Property

    Property Get RegisterD() As String
        RegisterD = State(4)
    End Property
    Public Function Md5_String_Calc(SourceString As String) As String
        MD5Init
        MD5Update LenB(StrConv(SourceString, vbFromUnicode)), StringToArray(SourceString)
        MD5Final
        Md5_String_Calc = GetValues
    End Function
    Public Function Md5_File_Calc(InFile As String) As String
    On Error GoTo errorhandler
    GoSub begin
    errorhandler:
        Dim DigestFileToHexStr As String
        DigestFileToHexStr = ""
        Exit Function
       
    begin:
        Dim FileO As Integer
        FileO = FreeFile
        Call FileLen(InFile)
        Open InFile For Binary Access Read As #FileO
        MD5Init
        Do While Not EOF(FileO)
            Get #FileO, , ByteBuffer
            If Loc(FileO) < LOF(FileO) Then
                ByteCounter = ByteCounter + 64
                MD5Transform ByteBuffer
            End If
        Loop
        ByteCounter = ByteCounter + (LOF(FileO) Mod 64)
        Close #FileO
        MD5Final
        Md5_File_Calc = GetValues
    End Function
    Private Function StringToArray(InString As String) As Byte()
        Dim I As Integer, bytBuffer() As Byte
        ReDim bytBuffer(LenB(StrConv(InString, vbFromUnicode)))
        bytBuffer = StrConv(InString, vbFromUnicode)
        StringToArray = bytBuffer
    End Function
    Public Function GetValues() As String
        GetValues = LongToString(State(1)) & LongToString(State(2)) & LongToString(State(3)) & LongToString(State(4))
    End Function
    Private Function LongToString(Num As Long) As String
            Dim A As Byte, B As Byte, C As Byte, D As Byte
            A = Num And &HFF&
            If A < 16 Then LongToString = "0" & Hex(A) Else LongToString = Hex(A)
            B = (Num And &HFF00&) / 256
            If B < 16 Then LongToString = LongToString & "0" & Hex(B) Else LongToString = LongToString & Hex(B)
            C = (Num And &HFF0000) / 65536
            If C < 16 Then LongToString = LongToString & "0" & Hex(C) Else LongToString = LongToString & Hex(C)
            If Num < 0 Then D = ((Num And &H7F000000) / 16777216) Or &H80& Else D = (Num And &HFF000000) / 16777216
            If D < 16 Then LongToString = LongToString & "0" & Hex(D) Else LongToString = LongToString & Hex(D)
    End Function

    Public Sub MD5Init()
        ByteCounter = 0
        State(1) = UnsignedToLong(1732584193#)
        State(2) = UnsignedToLong(4023233417#)
        State(3) = UnsignedToLong(2562383102#)
        State(4) = UnsignedToLong(271733878#)
    End Sub

    Public Sub MD5Final()
        Dim dblBits As Double, padding(72) As Byte, lngBytesBuffered As Long
        padding(0) = &H80
        dblBits = ByteCounter * 8
        lngBytesBuffered = ByteCounter Mod 64
        If lngBytesBuffered <= 56 Then MD5Update 56 - lngBytesBuffered, padding Else MD5Update 120 - ByteCounter, padding
        padding(0) = UnsignedToLong(dblBits) And &HFF&
        padding(1) = UnsignedToLong(dblBits) / 256 And &HFF&
        padding(2) = UnsignedToLong(dblBits) / 65536 And &HFF&
        padding(3) = UnsignedToLong(dblBits) / 16777216 And &HFF&
        padding(4) = 0
        padding(5) = 0
        padding(6) = 0
        padding(7) = 0
        MD5Update 8, padding
    End Sub
    Public Sub MD5Update(InputLen As Long, InputBuffer() As Byte)
        Dim II As Integer, I As Integer, J As Integer, K As Integer, lngBufferedBytes As Long, lngBufferRemaining As Long, lngRem As Long

        lngBufferedBytes = ByteCounter Mod 64
        lngBufferRemaining = 64 - lngBufferedBytes
        ByteCounter = ByteCounter + InputLen

        If InputLen >= lngBufferRemaining Then
            For II = 0 To lngBufferRemaining - 1
                ByteBuffer(lngBufferedBytes + II) = InputBuffer(II)
            Next II
            MD5Transform ByteBuffer
            lngRem = (InputLen) Mod 64
            For I = lngBufferRemaining To InputLen - II - lngRem Step 64
                For J = 0 To 63
                    ByteBuffer(J) = InputBuffer(I + J)
                Next J
                MD5Transform ByteBuffer
            Next I
            lngBufferedBytes = 0
        Else
          I = 0
        End If
        For K = 0 To InputLen - I - 1
            ByteBuffer(lngBufferedBytes + K) = InputBuffer(I + K)
        Next K
    End Sub
    Private Sub MD5Transform(Buffer() As Byte)
        Dim X(16) As Long, A As Long, B As Long, C As Long, D As Long
       
        A = State(1)
        B = State(2)
        C = State(3)
        D = State(4)
        Decode 64, X, Buffer
        FF A, B, C, D, X(0), S11, -680876936
        FF D, A, B, C, X(1), S12, -389564586
        FF C, D, A, B, X(2), S13, 606105819
        FF B, C, D, A, X(3), S14, -1044525330
        FF A, B, C, D, X(4), S11, -176418897
        FF D, A, B, C, X(5), S12, 1200080426
        FF C, D, A, B, X(6), S13, -1473231341
        FF B, C, D, A, X(7), S14, -45705983
        FF A, B, C, D, X(8), S11, 1770035416
        FF D, A, B, C, X(9), S12, -1958414417
        FF C, D, A, B, X(10), S13, -42063
        FF B, C, D, A, X(11), S14, -1990404162
        FF A, B, C, D, X(12), S11, 1804603682
        FF D, A, B, C, X(13), S12, -40341101
        FF C, D, A, B, X(14), S13, -1502002290
        FF B, C, D, A, X(15), S14, 1236535329

        GG A, B, C, D, X(1), S21, -165796510
        GG D, A, B, C, X(6), S22, -1069501632
        GG C, D, A, B, X(11), S23, 643717713
        GG B, C, D, A, X(0), S24, -373897302
        GG A, B, C, D, X(5), S21, -701558691
        GG D, A, B, C, X(10), S22, 38016083
        GG C, D, A, B, X(15), S23, -660478335
        GG B, C, D, A, X(4), S24, -405537848
        GG A, B, C, D, X(9), S21, 568446438
        GG D, A, B, C, X(14), S22, -1019803690
        GG C, D, A, B, X(3), S23, -187363961
        GG B, C, D, A, X(8), S24, 1163531501
        GG A, B, C, D, X(13), S21, -1444681467
        GG D, A, B, C, X(2), S22, -51403784
        GG C, D, A, B, X(7), S23, 1735328473
        GG B, C, D, A, X(12), S24, -1926607734

        HH A, B, C, D, X(5), S31, -378558
        HH D, A, B, C, X(8), S32, -2022574463
        HH C, D, A, B, X(11), S33, 1839030562
        HH B, C, D, A, X(14), S34, -35309556
        HH A, B, C, D, X(1), S31, -1530992060
        HH D, A, B, C, X(4), S32, 1272893353
        HH C, D, A, B, X(7), S33, -155497632
        HH B, C, D, A, X(10), S34, -1094730640
        HH A, B, C, D, X(13), S31, 681279174
        HH D, A, B, C, X(0), S32, -358537222
        HH C, D, A, B, X(3), S33, -722521979
        HH B, C, D, A, X(6), S34, 76029189
        HH A, B, C, D, X(9), S31, -640364487
        HH D, A, B, C, X(12), S32, -421815835
        HH C, D, A, B, X(15), S33, 530742520
        HH B, C, D, A, X(2), S34, -995338651

        II A, B, C, D, X(0), S41, -198630844
        II D, A, B, C, X(7), S42, 1126891415
        II C, D, A, B, X(14), S43, -1416354905
        II B, C, D, A, X(5), S44, -57434055
        II A, B, C, D, X(12), S41, 1700485571
        II D, A, B, C, X(3), S42, -1894986606
        II C, D, A, B, X(10), S43, -1051523
        II B, C, D, A, X(1), S44, -2054922799
        II A, B, C, D, X(8), S41, 1873313359
        II D, A, B, C, X(15), S42, -30611744
        II C, D, A, B, X(6), S43, -1560198380
        II B, C, D, A, X(13), S44, 1309151649
        II A, B, C, D, X(4), S41, -145523070
        II D, A, B, C, X(11), S42, -1120210379
        II C, D, A, B, X(2), S43, 718787259
        II B, C, D, A, X(9), S44, -343485551

        State(1) = LongOverflowAdd(State(1), A)
        State(2) = LongOverflowAdd(State(2), B)
        State(3) = LongOverflowAdd(State(3), C)
        State(4) = LongOverflowAdd(State(4), D)
    End Sub

    Private Sub Decode(Length As Integer, OutputBuffer() As Long, InputBuffer() As Byte)
        Dim intDblIndex As Integer, intByteIndex As Integer, dblSum As Double
        For intByteIndex = 0 To Length - 1 Step 4
            dblSum = InputBuffer(intByteIndex) + InputBuffer(intByteIndex + 1) * 256# + InputBuffer(intByteIndex + 2) * 65536# + InputBuffer(intByteIndex + 3) * 16777216#
            OutputBuffer(intDblIndex) = UnsignedToLong(dblSum)
            intDblIndex = intDblIndex + 1
        Next intByteIndex
    End Sub
    Private Function FF(A As Long, B As Long, C As Long, D As Long, X As Long, S As Long, ac As Long) As Long
        A = LongOverflowAdd4(A, (B And C) Or (Not (B) And D), X, ac)
        A = LongLeftRotate(A, S)
        A = LongOverflowAdd(A, B)
    End Function
    Private Function GG(A As Long, B As Long, C As Long, D As Long, X As Long, S As Long, ac As Long) As Long
        A = LongOverflowAdd4(A, (B And D) Or (C And Not (D)), X, ac)
        A = LongLeftRotate(A, S)
        A = LongOverflowAdd(A, B)
    End Function
    Private Function HH(A As Long, B As Long, C As Long, D As Long, X As Long, S As Long, ac As Long) As Long
        A = LongOverflowAdd4(A, B Xor C Xor D, X, ac)
        A = LongLeftRotate(A, S)
        A = LongOverflowAdd(A, B)
    End Function
    Private Function II(A As Long, B As Long, C As Long, D As Long, X As Long, S As Long, ac As Long) As Long
        A = LongOverflowAdd4(A, C Xor (B Or Not (D)), X, ac)
        A = LongLeftRotate(A, S)
        A = LongOverflowAdd(A, B)
    End Function

    Function LongLeftRotate(value As Long, Bits As Long) As Long
        Dim lngSign As Long, lngI As Long
        Bits = Bits Mod 32
        If Bits = 0 Then LongLeftRotate = value: Exit Function
        For lngI = 1 To Bits
            lngSign = value And &HC0000000
            value = (value And &H3FFFFFFF) * 2
            value = value Or ((lngSign < 0) And 1) Or (CBool(lngSign And &H40000000) And &H80000000)
        Next
        LongLeftRotate = value
    End Function
    Private Function LongOverflowAdd(Val1 As Long, Val2 As Long) As Long
        Dim lngHighWord As Long, lngLowWord As Long, lngOverflow As Long
        lngLowWord = (Val1 And &HFFFF&) + (Val2 And &HFFFF&)
        lngOverflow = lngLowWord / 65536
        lngHighWord = (((Val1 And &HFFFF0000) / 65536) + ((Val2 And &HFFFF0000) / 65536) + lngOverflow) And &HFFFF&
        LongOverflowAdd = UnsignedToLong((lngHighWord * 65536#) + (lngLowWord And &HFFFF&))
    End Function
    Private Function LongOverflowAdd4(Val1 As Long, Val2 As Long, val3 As Long, val4 As Long) As Long
        Dim lngHighWord As Long, lngLowWord As Long, lngOverflow As Long
        lngLowWord = (Val1 And &HFFFF&) + (Val2 And &HFFFF&) + (val3 And &HFFFF&) + (val4 And &HFFFF&)
        lngOverflow = lngLowWord / 65536
        lngHighWord = (((Val1 And &HFFFF0000) / 65536) + ((Val2 And &HFFFF0000) / 65536) + ((val3 And &HFFFF0000) / 65536) + ((val4 And &HFFFF0000) / 65536) + lngOverflow) And &HFFFF&
        LongOverflowAdd4 = UnsignedToLong((lngHighWord * 65536#) + (lngLowWord And &HFFFF&))
    End Function

    Private Function UnsignedToLong(value As Double) As Long
        If value < 0 Or value >= OFFSET_4 Then Error 6
        If value <= MAXINT_4 Then UnsignedToLong = value Else UnsignedToLong = value - OFFSET_4
    End Function
    Private Function LongToUnsigned(value As Long) As Double
        If value < 0 Then LongToUnsigned = value + OFFSET_4 Else LongToUnsigned = value
    End Function

    3、使用类产生MD5加密字符串
         Set md5 = New CMd5     'CMd5是新增类模块的名称
        strResult  = md5.Md5_String_Calc(srcString)                'srcStrnig是要加密的字符串,strResult为加密后的字符串

    展开全文
  • VB2008工程代码-加密汉字 字符串 Public Function StringEnDeCodecn(ByVal strSource As String, ByVal MA As Long) As String '该函数只中西文起到加密作用 '参数为:源文件,密码 On Error GoTo ErrEnDeCode...
  • 一个简单实用的VB字符串加密、解密程序,可以是文本或字符,加密效果好,速度快,安全性高,而且代码易用易学,程序中还使用到了一个XP风格的进度条控件,VB新手朋友正好也可以研究一下进度条的使用。运行效果如演示...
  • VB6的一个字符加密、解密的函数

    千次阅读 2010-08-29 11:55:00
    原来这个是delphi的、我翻译了一下、我感觉还是不错的、唯一的问题是不支持中文、不过没关系、反正我从来我对中文字符串加密的、 加密函数   Private ... '//对字符串加密(Src:源 Key:密匙)

    原来这个是delphi的、我翻译了一下、我感觉还是不错的、唯一的问题是不支持中文、不过没关系、反正我从来我对中文字符串加密的、

    加密函数

     

     

    解密函数

    展开全文
  • 该模块使用vb语言,用于对字符串加密以及解密。另外,本模块标注有使用方法,方便使用。
  • 摘要:VB源码,加密解密,AES,字符串加密  AES加密算法VB源码演示程序,涉及加密算法以及文件加密、解密,在多种场合中都可应用,本加密程序可以加密字符和加密文件,当然也可解密,学习AES算法当然是挺有参考意义的...
  • 文本字符串加密 解密软件 VB工程源代码,直接运行工程可以看到软件效果,编译通过。软件功能是文本字符串进行加密,和解密。代码版权规作者所有,仅供大学学习参考之用,任何单位或个人未经作者同意不得另做他用。...
  • 使用XOR对字符串进行加密与解密,私钥通过SHA256或SHA512进行编码。全程推荐使用UTF-8编码。

    以下代码已经编译成库,可直接引用调用,也可自行编译。语法简单,应该不会有太多的问题。也可自行对最终的编码进行旋转、对调等。


    从Runplus.Studio下载




    Imports System.Security.Cryptography
    Namespace Runplus.Utils.Encoder
        '************************************************
        '* https://www.runplus.studio/Utils/Encoder
        '* Likun@Runplus.cn
        '************************************************
        Module XOREncoder
            Sub Main()
                '示例代码
                Dim Ret As String = "" '定义返回参数,以传址方式传入
    
                If Encoder("Hello World!", "12345abcde", Ret) Then
                    Console.WriteLine(Ret)
                Else
                    Console.WriteLine(Ret)
                End If
                If Decoder(Ret, "12345abcde", Ret) Then
                    Console.WriteLine(Ret)
                Else
                    Console.WriteLine(Ret)
                End If
    
                Console.ReadLine()
    
            End Sub
            Public Function Encoder(Source As String, Key As String, ByRef Ret As String) As Boolean
                Try
                    If Source.Length = 0 Or Key.Length = 0 Then
                        Ret = "明文或私钥为空,不能进行加密。"
                        Return False
                    Else
                        Dim ArrKey() As Byte = MakeKey(Key)
                        Dim ArrSource() As Byte = Text.Encoding.UTF8.GetBytes(Source)
                        For i As Integer = 0 To ArrSource.Length - 1 Step 32
                            For j As Integer = 0 To 31 Step 1
                                If i + j = ArrSource.Length Then
                                    Exit For
                                Else
                                    ArrSource(i + j) = ArrSource(i + j) Xor ArrKey(j)
                                End If
                            Next
                        Next
                        Ret = ConvertToBase64(ArrSource)
                        Return True
                    End If
                Catch ex As Exception
                    Ret = ex.Message
                    Return False
                End Try
            End Function
    
            Public Function Decoder(Source As String, key As String, ByRef Ret As String) As Boolean
                Try
                    If Source.Length = 0 Or key.Length = 0 Then
                        Ret = "明文或私钥为空,不能进行加密。"
                        Return False
                    Else
                        Dim ArrKey() As Byte = MakeKey(key)
                        Dim ArrSource() As Byte = ConvertFromBase64(Source)
                        For i As Integer = 0 To ArrSource.Length - 1 Step 32
                            For j As Integer = 0 To 31 Step 1
                                If i + j = ArrSource.Length Then
                                    Exit For
                                Else
                                    ArrSource(i + j) = ArrSource(i + j) Xor ArrKey(j)
                                End If
                            Next
                        Next
                        Ret = Text.Encoding.UTF8.GetString(ArrSource)
                        Return True
                    End If
                Catch ex As Exception
                    Ret = ex.Message
                    Return False
                End Try
            End Function
            Private Function MakeKey(ByRef Key As String) As Byte()
                If Key.Length = 0 Then
                    Return Nothing
                Else
                    Return SHA256(Text.Encoding.UTF8.GetBytes(Key))
                End If
            End Function
    
            Private Function SHA256(Source As Byte()) As Byte()
                If Source.Length = 0 Then
                    Return Nothing
                Else
                    Dim shaM As New SHA256Managed
                    Return shaM.ComputeHash(Source)
                End If
            End Function
            Private Function ConvertToBase64(Source As Byte()) As String
                If Source.Length = 0 Then
                    Return Nothing
                Else
                    Return Convert.ToBase64String(Source).Replace("+", "*").Replace("/", "!")
                End If
            End Function
            Private Function ConvertFromBase64(Source As String) As Byte()
                If Source.Length = 0 Then
                    Return Nothing
                Else
                    Return Convert.FromBase64String(Source.Replace("*", "+").Replace("!", "/"))
                End If
            End Function
        End Module
    End Namespace



    展开全文
  • VB VBA ASP 可通用的基于Base64进行加密和解密的函数可用于Access VBA 以及 Excel VBA对字符串 数据甚至文本文件进行加密和解密,以保证您数据的安全。先创建一个模块,在模块中添加如下代码OPTION EXPLICITconst ...

    VB VBA ASP 可通用的基于Base64进行加密和解密的函数

    可用于Access VBA 以及 Excel VBA对字符串 数据甚至文本文件进行加密和解密,以保证您数据的安全。

    先创建一个模块,在模块中添加如下代码

    OPTION EXPLICIT

    const BASE_64_MAP_INIT = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

    dim newline

    dim Base64EncMap(63)

    dim Base64DecMap(127)

    '初始化函数

    PUBLIC SUB initCodecs()

    ' 初始化变量

    newline =vbCrlf ' 如果是ASP就改成这个 "

    " & chr(13) & chr(10)

    dim max, idx

    max = len(BASE_64_MAP_INIT)

    for idx = 0 to max - 1

    Base64EncMap(idx) = mid(BASE_64_MAP_INIT, idx + 1, 1)

    next

    for idx = 0 to max - 1

    Base64DecMap(ASC(Base64EncMap(idx))) = idx

    next

    END SUB

    'Base64加密函数

    PUBLIC FUNCTION base64Encode(plain)

    if len(plain) = 0 then

    base64Encode = ""

    exit function

    end if

    dim ret, ndx, by3, first, second, third

    by3 = (len(plain) \ 3) * 3

    ndx = 1

    do while ndx <= by3

    first = asc(mid(plain, ndx+0, 1))

    second = asc(mid(plain, ndx+1, 1))

    third = asc(mid(plain, ndx+2, 1))

    ret = ret & Base64EncMap( (first \ 4) AND 63 )

    ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second \ 16) AND 15 ) )

    ret = ret & Base64EncMap( ((second * 4) AND 60) + ((third \ 64) AND 3 ) )

    ret = ret & Base64EncMap( third AND 63)

    ndx = ndx + 3

    loop

    if by3 < len(plain) then

    first = asc(mid(plain, ndx+0, 1))

    ret = ret & Base64EncMap( (first \ 4) AND 63 )

    if (len(plain) MOD 3 ) = 2 then

    second = asc(mid(plain, ndx+1, 1))

    ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second \ 16) AND 15 ) )

    ret = ret & Base64EncMap( ((second * 4) AND 60) )

    else

    ret = ret & Base64EncMap( (first * 16) AND 48)

    ret = ret '& "="

    end if

    ret = ret '& "="

    end if

    base64Encode = ret

    END FUNCTION

    'Base64解密函数

    PUBLIC FUNCTION base64Decode(scrambled)

    if len(scrambled) = 0 then

    base64Decode = ""

    exit function

    end if

    dim realLen

    realLen = len(scrambled)

    do while mid(scrambled, realLen, 1) = "="

    realLen = realLen - 1

    loop

    dim ret, ndx, by4, first, second, third, fourth

    ret = ""

    by4 = (realLen \ 4) * 4

    ndx = 1

    do while ndx <= by4

    first = Base64DecMap(asc(mid(scrambled, ndx+0, 1)))

    second = Base64DecMap(asc(mid(scrambled, ndx+1, 1)))

    third = Base64DecMap(asc(mid(scrambled, ndx+2, 1)))

    fourth = Base64DecMap(asc(mid(scrambled, ndx+3, 1)))

    ret = ret & chr( ((first * 4) AND 255) + ((second \ 16) AND 3))

    ret = ret & chr( ((second * 16) AND 255) + ((third \ 4) AND 15))

    ret = ret & chr( ((third * 64) AND 255) + (fourth AND 63))

    ndx = ndx + 4

    loop

    if ndx < realLen then

    first = Base64DecMap(asc(mid(scrambled, ndx+0, 1)))

    second = Base64DecMap(asc(mid(scrambled, ndx+1, 1)))

    ret = ret & chr( ((first * 4) AND 255) + ((second \ 16) AND 3))

    if realLen MOD 4 = 3 then

    third = Base64DecMap(asc(mid(scrambled,ndx+2,1)))

    ret = ret & chr( ((second * 16) AND 255) + ((third \ 4) AND 15))

    end if

    end if

    base64Decode = ret

    END FUNCTION

    ' 初始化

    call initCodecs

    ' 测试代码

    dim inp, encode

    inp = "1234567890"

    encode = base64Encode(inp)

    Debug.Print "加密前为:" & inp & vbCrlf

    Debug.Print "加密后为:" & encode & vbCrlf

    Debug.Print "解密后为:" & base64Decode(encode) & vbCrlf

    展开全文
  • VB代码,编译通过,生成软件注册码,原理是获取网卡...其中MAC字符串进行加密成数字的算法是相当值得学习的。将字符串转换成数字,再通过数学运算就可以达到加密文本的效果,反过来运算便是解密密文。这个用处太大了
  • 1. 通过查找当前模块中的名称(标签),然后查找输入...2. 通过查找所有字符串来定位断点地址,这也是最最常用的方法之一,对于没有对字符串加密的程序来说特别有效,但对加密的基本上就无能为力了。 3. 通过查
  • 一个Base64.java加密解密类文件,对字符串或文件进行Base64编码的加密或解密,这个类可实现此种功能。Base64应该算是比较常用的加密方法了,不但在Java编程中常见,其它编程语言VC、Delphi、VB等,也都经常用到,这...
  • 学习Cryptography 加密解密验证实例源代码,VB.NET VS2010开发 包括: 1、用于字符串和byte[]之间的互转 2、产生一对公钥私钥 3、生成公匙 4、生成私匙 5、用公匙进行加密 6、用私匙解密验证
  • 1,字符串的划分,处理. 2,listView,webbrowser和inet控件的使用. 3,异或加密解密 问题总结: 1,inet控件获取信息时,返回的信息不全,改为webbrowse控件获取. 2,不能联网,inet请求过于频繁等等进行了容错处理. ...
  • key2=value2…)拼接成字符串,最后拼接上key进行MD5加密。  规则: . ◆ 参数名ASCII码从小到大排序(字典序); . ◆ 如果参数的值为空不参与签名; . ◆ 参数名区分大小写; . ◆参数名Sign 、Key不参与...
  • 本资源有以下功能: 1.可获取硬盘的物理序列号. 2.INI配置文件的操作. 3.EXE文件只允许执行...4.MD5字符串加密函数. 5.获取汉字简拼(即汉语拼音首字母)函数. 注: 使用说明还没有来得急写呢!呵呵! (msaildll.dll)
  • 原文:C#/VB.NET 获取电脑属性(硬盘ID、硬盘容量、Cpu序列号、MAC地址、系统类型)在开发过程中,经常需要获取电脑的一些属性,如获取硬盘ID/CPU序列号/MAC地址作为来加密字符串。 1、硬盘 在我查看网上一些文档...
  • VB封装API的DLL

    2008-02-21 15:44:23
    ------EncodeData加密后的数据进行解密 13、EncodeData-------给定的字符串进行Base64算法的加密 14、GetCompName------获取本地计算机名字 15、GetCurrUser------获取当前登录用户名 16、GetSysDir...
  • browsefolders5.zip 浏览一个子目录(3KB) 61,easymail.zip 文件加密/解密的例子(5KB) 62,encstrings.zip 加密/解密字符串的例子(2KB) 63,keybinf.zip 键盘信息报告例子(2KB) 64,reginq....
  • f039_fileinfo.ZIP 显示文件的各种信息(12KB) 19,f038_stringinfile.ZIP 如何在一个文件中查找一个字符串(1KB) 20,f037_dragfrom.ZIP 支持从文件浏览器里拖入文件(4KB) 21,f036_findfile.ZIP ...
  • rotfont.zip 用VB实现字体的旋转 622,o033_998162026.zip 制作安装程序常用的模块(2KB) 623,o032_play024.zip 电子爱好者是一个不错的选择(7KB) 624,o031_Play39.zip 时间、空间大小等数据向...
  • rotfont.zip 用VB实现字体的旋转 622,o033_998162026.zip 制作安装程序常用的模块(2KB) 623,o032_play024.zip 电子爱好者是一个不错的选择(7KB) 624,o031_Play39.zip 时间、空间大小等数据向...
  • rotfont.zip 用VB实现字体的旋转 622,o033_998162026.zip 制作安装程序常用的模块(2KB) 623,o032_play024.zip 电子爱好者是一个不错的选择(7KB) 624,o031_Play39.zip 时间、空间大小等数据向...
  • rotfont.zip 用VB实现字体的旋转 622,o033_998162026.zip 制作安装程序常用的模块(2KB) 623,o032_play024.zip 电子爱好者是一个不错的选择(7KB) 624,o031_Play39.zip 时间、空间大小等数据向...
  •  Console.WriteLine("进行MD5加密字符串为:" + source + " 加密的结果是:" + hash + ".")  Console.WriteLine("验证哈希...")  If verifyMd5Hash(source, hash) Then  Console.WriteLine("哈希值是相同的。...

空空如也

空空如也

1 2 3 4 5
收藏数 96
精华内容 38
关键字:

vb对字符串加密