Versuch, Hex mit AutoHotKey über die Zwischenablage in Base64 zu verschlüsseln

Versuch, Hex mit AutoHotKey über die Zwischenablage in Base64 zu verschlüsseln

Ich habe einen Code, der die hervorgehobene URL in Base64 dekodiert.

Jetzt möchte ich eine hervorgehobene Hexadezimalzahl in Base64 kodieren, aber ich bekomme es nicht zum Laufen : /

Als Beispiel haben wir hexadezimal: 3648af61e4473d60d85481bf822a6d04316615efd6cd903d6bdc05b8c9ae58bfbabbb154099e345e4e12d770a774ad599420af221c26a7e0f21f9f1fc43a6d14 und wollen das base64 kodieren. Als Ergebnis bekomme ich

MzY0OGFmNjFlNDQ3M2Q2MGQ4NTQ4MWJmODIyYTZkMDQzMTY2MTVlZmQ2Y2Q5MDNkNmJkYzA1YjhjOWFlNThiZmJhYmJiMTU0MDk5ZTM0NWU0ZTEyZDc3MGE3NzRhZDU5OTQyMGFmMjIxYzI2YTdlMGYyMWY5ZjFmYzQzYTZkMTQ=

aber es muss seinNkivYeRHPWDYVIG/giptBDFmFe/WzZA9a9wFuMmuWL+6u7FUCZ40Xk4S13CndK1ZlCCvIhwmp+DyH58fxDptFA==

Der Code, den ich bisher habe, ist

#SingleInstance, Force

;***********Decode URL******************* 
!d:: ;Alt+d will Decode highlighted text from URL to base64
gosub Store_Clipboard_Copy_Selected_Text
Clipboard:=URiDecode(clipboard) ;Decode URL
Gosub Paste_and_Restore_Stored_Clipboard ;restore clipboard
return



;***********Decode HEX******************* 
!f:: ;Alt+f will Encode highlighted text from Hex to base64
gosub Store_Clipboard_Copy_Selected_Text
Clipboard:=Base64Encode(clipboard) ; Encode HEX
Gosub Paste_and_Restore_Stored_Clipboard ;restore clipboard
return

;*******Store Clipboard- save for restoring, and copy selected text to clipboard****************
Store_Clipboard_Copy_Selected_Text:
Store:=ClipboardAll  ;Store full version of Clipboard
  clipboard = ; Empty the clipboard
  SendInput, ^c ;changd from Send  11/23
  ClipWait, 1
    If ErrorLevel ;Added errorLevel checking
      {
        MsgBox, No text was sent to clipboard
        Return
      }
return

;**********************restore clipboard*********************************
Paste_and_Restore_Stored_Clipboard:  ;put back original content
SendEvent , ^v
Clipboard:=Store
return

uriDecode(str) {
    Loop
 If RegExMatch(str, "i)(?<=%)[\da-f]{1,2}", hex)
    StringReplace, str, str, `%%hex%, % Chr("0x" . hex), All
    Else Break
 Return, str
}

Base64Encode(String)
{
    static CharSet := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    VarSetCapacity(Output,Ceil(Length / 3) << 2)
    Index := 1, Length := StrLen(String)
    Loop, % Length // 3
    {
        Value := Asc(SubStr(String,Index,1)) << 16
            | Asc(SubStr(String,Index + 1,1)) << 8
            | Asc(SubStr(String,Index + 2,1))
        Index += 3
        Output .= SubStr(CharSet,(Value >> 18) + 1,1)
            . SubStr(CharSet,((Value >> 12) & 63) + 1,1)
            . SubStr(CharSet,((Value >> 6) & 63) + 1,1)
            . SubStr(CharSet,(Value & 63) + 1,1)
    }
    Length := Mod(Length,3)
    If Length = 0 ;no characters remaining
        Return, Output
    Value := Asc(SubStr(String,Index,1)) << 10
    If Length = 1
    {
        Return, Output ;one character remaining
            . SubStr(CharSet,(Value >> 12) + 1,1)
            . SubStr(CharSet,((Value >> 6) & 63) + 1,1) . "=="
    }
    Value |= Asc(SubStr(String,Index + 1,1)) << 2 ;insert the third character
    Return, Output ;two characters remaining
        . SubStr(CharSet,(Value >> 12) + 1,1)
        . SubStr(CharSet,((Value >> 6) & 63) + 1,1)
        . SubStr(CharSet,(Value & 63) + 1,1) . "="
}

Ich weiß nicht, wie ich das richtige Ergebnis bekomme und was mit dem Code nicht stimmt? :(

verwandte Informationen