• <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>
            <2006年9月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            1234567

            統(tǒng)計

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

            常用鏈接

            留言簿(4)

            隨筆分類

            隨筆檔案

            相冊

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            VBScript寫的計算異或的一個小工具
            工作中經(jīng)常會需要計算一大串字節(jié)的異或,用計算器手工一個一個的輸入太累人了,碰巧這兩天在關(guān)注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 小蔥蘸醬 閱讀(1275) 評論(0)  編輯 收藏 引用 所屬分類: 編碼點滴

            久久久久无码精品国产不卡| 亚洲综合久久综合激情久久| 午夜精品久久久久| 久久99国产精品一区二区| 国产美女久久久| 久久亚洲AV无码精品色午夜| 丰满少妇高潮惨叫久久久| 精品久久综合1区2区3区激情| 精品久久人人爽天天玩人人妻| 狠狠精品久久久无码中文字幕 | 久久亚洲精品中文字幕| 人人狠狠综合久久亚洲婷婷| 久久这里都是精品| 久久精品国产亚洲麻豆| 一本色道久久88精品综合| 久久精品国产亚洲麻豆| 国产精品99久久久精品无码| 久久久精品人妻无码专区不卡 | 2021精品国产综合久久| 色诱久久av| 国产精品免费久久久久久久久 | 国产精品99久久精品爆乳| 亚洲va中文字幕无码久久不卡 | 国产成人精品久久一区二区三区av | 久久久WWW成人免费精品| 成人免费网站久久久| 亚洲香蕉网久久综合影视| 欧美久久亚洲精品| 久久久久国产一级毛片高清板 | 99麻豆久久久国产精品免费| 99久久做夜夜爱天天做精品| 久久久久无码精品| 中文字幕无码久久久| 欧美一级久久久久久久大片| 日产久久强奸免费的看| 亚洲精品无码专区久久同性男| 久久久久99精品成人片| 性高湖久久久久久久久AAAAA| 久久久久无码精品| 久久91精品国产91久| 婷婷五月深深久久精品|