• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            統計

            • 隨筆 - 24
            • 文章 - 0
            • 評論 - 17
            • 引用 - 0

            常用鏈接

            留言簿(4)

            隨筆分類

            隨筆檔案

            相冊

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            VBScript寫的計算異或的一個小工具
            工作中經常會需要計算一大串字節的異或,用計算器手工一個一個的輸入太累人了,碰巧這兩天在關注VBScript,于是就想到寫了這個工具。這是我第一次用VB,代碼很簡單,希望能對你有用。

            '==========================================================================
            '
            '
            '
             NAME: calc_xor.vbs
            '
            '
             COMMENT: Calculates the result of 'xor' all elements in the input
            '
            '
            ==========================================================================

            Option Explicit

            Dim strInput

            'Promt for string to search for in log files
            strInput = InputBox("Enter data to calc on.","calc xor","")

            if strInput = "" then
                wscript.quit
            end If

            'MsgBox(Len(strInput))

            Dim arrayBytes()
            ReDim arrayBytes(Len(strInput)/2)

            Dim i,nBytes
            Dim chHalf1,chHalf2,chWhole
            = 1
            nBytes 
            = 0

            Do While (i < Len(strInput))
            'Skip spaces between elements
            Do While Asc(Mid(strInput,i,1)) = 32 'space
                i = i + 1
            Loop 

                chHalf1 
            = Asc(Mid(strInput,i,1))
                chHalf2 
            = Asc(Mid(strInput,i+1,1))
                
            'Check and convert first half

                
            If chHalf1 >= 48 And chHalf1 <= 57 Then
                    chHalf1 
            = chHalf1 - 48
                
            ElseIf chHalf1 >= 65 And chHalf1 <= 70 Then
                    chHalf1 
            = chHalf1 - 65 + 10
                
            ElseIf chhalf1 >= 97 And chHalf1 <= 104 Then
                    chHalf1 
            = chHalf1 - 97 + 10
                
            Else
                    
            MsgBox("invalid character")
                    wscript.quit
                
            End If
                
                
            ' Check and convert the second half
                If chHalf2 >= 48 And chHalf2 <= 57 Then
                    chHalf2 
            = chHalf2 - 48
                
            ElseIf chHalf2 >= 65 And chHalf2 <= 70 Then
                    chHalf2 
            = chHalf2 - 65 + 10
                
            ElseIf chHalf2 >= 97 And chHalf2 <= 104 Then
                    chHalf2 
            = chHalf2 - 97 + 10
                
            Else
                    
            MsgBox("invalid character")
                    wscript.quit
                
            End If
                
                
            ' Combine the first and second halves together to form a whole byte
                chWhole = chHalf1 * 16 + chHalf2
                arrayBytes(nBytes) 
            = chWhole
                i 
            = i + 2
                nBytes 
            = nBytes + 1
            Loop

            'MsgBox(CStr(nBytes) + " bytes all together")

            Dim WshSHell
            set WshShell = CreateObject("WScript.Shell")
            WshShell.Run(
            "calc")
            WScript.Sleep(
            100)
            WshShell.AppActivate(
            "Calculator")
            WScript.Sleep(
            100)

            WshShell.SendKeys(
            "{F6}"'Change to Decimal
            '
            WshShell.SendKeys("{F4}") 'Change to single byte
            WScript.Sleep(100)
            WshShell.SendKeys(
            "0")
            For i =1 to nBytes
                WshShell.SendKeys(
            "{^}")
                WScript.Sleep(
            100)
                WshShell.SendKeys(arrayBytes(i
            -1))
                WScript.Sleep(
            100)
                WshShell.SendKeys(
            "{=}")
                WScript.Sleep(
            100)
            Next

            WshShell.SendKeys(
            "{F5}"'Change to Hex for easy recognition



            posted on 2007-08-03 13:05 小蔥蘸醬 閱讀(1276) 評論(0)  編輯 收藏 引用 所屬分類: 編碼點滴

            久久精品成人国产午夜| 99久久免费国产精精品| 亚洲婷婷国产精品电影人久久| 国产69精品久久久久9999| 久久av免费天堂小草播放| 欧美精品乱码99久久蜜桃| 奇米影视7777久久精品| 国产91久久综合| 一本一本久久a久久综合精品蜜桃| 国产麻豆精品久久一二三| 久久精品国产黑森林| 熟妇人妻久久中文字幕| 欧洲国产伦久久久久久久 | 精品水蜜桃久久久久久久| 国产精品一区二区久久精品涩爱| 久久亚洲AV成人出白浆无码国产| 精品乱码久久久久久夜夜嗨| 久久午夜羞羞影院免费观看| 亚洲国产精品狼友中文久久久| 99久久精品午夜一区二区| 国产精品久久久久久久久久影院| 国产精品对白刺激久久久| 伊人久久成人成综合网222| 99久久精品国产一区二区蜜芽 | 伊色综合久久之综合久久| avtt天堂网久久精品| A级毛片无码久久精品免费 | 久久国产色AV免费观看| 欧美精品九九99久久在观看| 国内精品久久久久久中文字幕| 精品久久久久久亚洲精品| 无码精品久久久久久人妻中字 | 久久久久高潮综合影院| 久久有码中文字幕| 精品综合久久久久久88小说| 久久久久久久综合日本亚洲| 精品久久久久久亚洲精品 | 久久亚洲AV无码精品色午夜| 亚洲精品视频久久久| 久久一本综合| 久久精品国产亚洲av麻豆蜜芽|