eltorro Posted December 8, 2007 Posted December 8, 2007 (edited) I was playing with some example code on the net that outlines using RSA keys to create a software registration code. Part of the process involved base32 encoding the key to shrink it's size down. All I wanted was a little utility like md5sums or base64 but could not find one to my liking. I found some java code and converted it into a udf and then into a utility. The script below is a meant to be a command line utility and uses picasso's MakeCUI utility to change compiled script.expandcollapse popup#Include <user\getopt.au3> #Include <user\base32.au3> ;change to console app. #AutoIt3Wrapper_Res_Description=Base32 Encoder/Decoder #AutoIt3Wrapper_Res_Fileversion=0.1.0.17 #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p #AutoIt3Wrapper_run_after=C:\PROGRA~1\SCINTI~1\AUTOIT~1\MakeCUI.exe "%out%" Local $cmd = $CmdLine _OPT_FIFO($cmd); strip off arg count. ; Put the valid short options into string. ; a colon ":" following a letter indicates that it needs an argument ; A double colon "::" indicates that an argument is optional Local $sShortOpts = "desh?" ; Put the valid long format options into an array. ; An equal sign as the last character of the option indicates that it requires an agrument. Local $aLongOpts[5] = ["help","encode","decode","string","version"] ;parse the command line options into a 2 dim array. Local $options = _OPT_GetOpt($cmd, $sShortOpts, $aLongOpts) If @error Then ShowUsage () Exit EndIf _Base32_BuildTable() main() Func main () Local $iIndex = -1 Local $bFiles = False Select Case _OPT_MatchOption("-h,-?,--help",$options,$iIndex) ShowUsage() Case _OPT_MatchOption("--version",$options,$iIndex) ShowVersion() Case $cmd[0] = "" ShowUsage() Case _OPT_MatchOption("-s,--string",$options,$iIndex) Select Case _OPT_MatchOption("-d,--decode",$options,$iIndex) ConsoleWrite(_Base32_Decode($cmd[0])&@LF) Case _OPT_MatchOption("-e,--encode",$options,$iIndex) ConsoleWrite(_Base32_Encode($cmd[0])&@LF) Case Else ShowUsage() EndSelect Case _OPT_MatchOption("-d,--decode",$options,$iIndex) If UBound($cmd) = 1 Then If FileExists ($cmd[0]) Then ConsoleWrite(_Base32_Decode(FileRead($cmd[0]))&@LF) Else ConsoleWrite(_Base32_Decode($cmd[0])&@lf) EndIf Else If FileExists($cmd[0]) Then Local $hf = FileOpen($cmd[1],18) FileWrite($hf,_Base32_Decode(FileRead($cmd[0]))) FileClose($hf) Else ConsoleWrite(StringFormat("%s does not exist.\n",$cmd[0])) EndIf EndIf Case _OPT_MatchOption("-e,--encode",$options,$iIndex) If UBound($cmd) = 1 Then If FileExists ($cmd[0]) Then ConsoleWrite(_Base32_Encode(FileRead($cmd[0]))&@LF) Else ConsoleWrite(_Base32_Encode($cmd[0])&@lf) EndIf Else If FileExists($cmd[0]) Then Local $hf = FileOpen($cmd[1],18) FileWrite($hf,_Base32_Encode(FileRead($cmd[0]))) FileClose($hf) Else ConsoleWrite(StringFormat("%s does not exist.\n",$cmd[0])) EndIf EndIf Case Else ConsoleWrite(_Base32_Encode($cmd[0])&@LF) EndSelect ;ConsoleWrite(encode("Ok this is a test") & @LF) ;ConsoleWrite(decode("J5VSA5DINFZSA2LTEBQSA5DFON2A")& @LF) EndFunc Func ShowUsage() $usage = "\n" & _ "base32 -- Encode/decode file or string as base32. Call:\n" & _ " base32 [-e / -d] [options] [infile] [outfile]\n\n" & _ "Options:\n" & _ " -d, --decode Decode base32 encoded file/string\n" & _ " -e, --encode Encode file/string into base32\n" & _ " -s, --string Argument is a string value \n" & _ " -h, --help Print this message\n" & _ " --version Print version number\n\n" & _ "Stephen Podhajecki\n" & _ "http://ocotillo.sytes.net\n" & _ "\nOriginal Java version Author: Frederik Zimmer Copyright © 2001\n" & _ "tristian@users.sourceforge.net" ConsoleWrite(StringFormat($usage)) EndFunc Func ShowVersion() $version = "\n"& _ "base32 -- %s\n" & _ "Copyright © 2007 Stephen Podhajecki (This port.)\n" & _ "Copyright © 2001 Frederik Zimmer (Java implementation)\n" & _ "This is free software; see the source for copying conditions. There is NO\n" & _ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ConsoleWrite(StringFormat($version,FileGetVersion(@ScriptFullPath))) EndFuncEDIT: - Includes in following post.Enjoy. Edited December 8, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code
eltorro Posted December 8, 2007 Author Posted December 8, 2007 (edited) Crap, I edited the previous post and it or I clipped the includes off. expandcollapse popup; ==================================================================================================== =========================== ;Base32 encoding decoding adapted from: ;http://www.docjar.com/src/api/xnap/plugin/gnutella/util/Base32.java ;ported to AutoIt by Stephen Podhajecki {gehossafats at netmdc dot com} ;this port falls under GPL ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 2 ;; of the License, or any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;; ; ==================================================================================================== =========================== Const $BASE32CHARS ="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; Local $_BASE32_DECODE_TABLE[128] Local $BASE32_INIT = 0 ; #FUNCTION# ==================================================================================================== ================= ; Description ...: Encode a string as base32 ; Parameters ....: $vData - IN - Data to decode. ; Return values .: On Success - Encoded data ; On Failure - @error set to 1, 0 returned ; Author ........: Ported by Stephen Podhajecki {gehossafats at netmdc. com} ; Remarks .......: Works with text strings and files. ; Related .......: _Base32_Decode ; ==================================================================================================== ============================ Func _Base32_Encode($vData) If $BASE32_INIT = 0 Then If Not _Base32_BuildTable() Then Return SetError(1,0,0) EndIf Local $data = __Split_Key($vData) Local $dataLength = UBound($data) If Not $dataLength > 0 Then Return SetError(1,0,0) Local $chars[$dataLength*8/5 +(1*(Mod($dataLength,5)>0))] Local $charsLength = UBound($chars) Local $i = 0, $j =0, $index =0, $b =0 Local $ALPHABET = __Split_Key($BASE32CHARS) For $i =0 to $charsLength -1 If $index > 3 Then $b = BitAnd(ASC($data[$j]) ,BitShift(0xFF,$index)) $index = Mod($index+5,8) $b = BitShift($b,-$index) if $j < $dataLength -1 Then $b =BitOR($b,BitShift(BitAND(ASC($data[$j+1]),0xFF), (8-$index))) EndIf $chars[$i] = $ALPHABET[$b] $j += 1 Else $chars[$i] = $ALPHABET[BitAnd(BitShift(ASC($data[$j]),(8-($index+5))),0x1F)] $index = Mod($index +5,8) if $index =0 Then $j +=1 EndIf EndIf Next Local $sEncoded = "" For $x = 0 to UBound($chars)-1 $sEncoded &= $chars[$x] Next Return $sEncoded EndFunc ; #FUNCTION# ==================================================================================================== ================= ; Description ...: Decode a base32 encoded string ; Parameters ....: $vData - IN - Data to decode. ; Return values .: On Success - Decoded data ; On Failure - @error set to 1, 0 returned ; Author ........: Ported by Stephen Podhajecki {gehossafats at netmdc. com} ; Remarks .......: Works with text strings and files. ; Related .......: _Base32_Encode ; ==================================================================================================== ============================ Func _Base32_Decode($vData) If $BASE32_INIT = 0 Then If Not _Base32_BuildTable() Then Return SetError(1,0,0) EndIf Local $stringData = __Split_Key($vData) Local $stringDataLength = UBound($stringData) If Not $stringDataLength > 0 Then Return SetError(1,0,0) Local $data[(($stringDataLength*5)/8)] Local $dataLength = UBound($data) Local $i, $j =0, $index = 0, $val =0, $decoded = "" For $i = 0 to $stringDataLength -1 $val =0 $val = $_BASE32_DECODE_TABLE[ASC($stringData[$i])] If $val = 0xFF Then ;;rem illegal character Return SetError(1,0,0) EndIf If ($index <=3) Then $index = Mod($index+5,8) If $index = 0 Then $data[$j] = BitOr($data[$j],$val) $j += 1 Else $data[$j] = BitOR($data[$j],BitShift($val, -(8-$index))) EndIf Else $index = Mod($index+5,8) $data[$j] = BitOr($data[$j],BitShift($val,$index)) $j += 1 if $j < $dataLength Then $data[$j] = BitOr($data[$j],BitShift($val, -(8 - $index))) $data[$j] = BitAnd($data[$j],0xFF) EndIf EndIf Next For $x = 0 to UBound($data) -1 $decoded &= Chr($data[$x]) Next Return $decoded EndFunc ; ==================================================================================================== =========================== ; _Base32_BuildTable(): Builds a conversion table ; ==================================================================================================== =========================== Func _Base32_BuildTable() For $i = 0 to UBound($_BASE32_DECODE_TABLE)-1 $_BASE32_DECODE_TABLE[$i] = 0xFF Next For $i = 0 to StringLen($BASE32CHARS)-1 $_BASE32_DECODE_TABLE[ASC(StringMid($BASE32CHARS,$i+1,1))]= $i if $i < 24 Then $_BASE32_DECODE_TABLE[ASC(StringLower(StringMid($BASE32CHARS,$i+1,1)))]= $i EndIf Next $BASE32_INIT = 1 Return 1 EndFunc ; ==================================================================================================== =========================== ; __Split_Key: Internal function ; splits a string into an array of characters and strip the count value from the first element. ; ==================================================================================================== =========================== Func __Split_Key($szKey, $szDelim = "") If $szKey = "" Then Return SetError(1, 0, 0) If IsArray($szKey) Then Return $szKey Local $iCount, $szTemp = "" Local $aTemp = StringSplit($szKey, $szDelim) If Not @error Then Local $iCount = $aTemp[0], $iTotal = 0 For $x = 1 To $iCount $iTotal += 1 $aTemp[$x - 1] = $aTemp[$x] Next ReDim $aTemp[$iTotal] Return $aTemp EndIf Return SetError(1, 0, 0) EndFunc ;==>__Split_Key getopt ported to Autoit expandcollapse popup#Include-once ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with parsing command line arguments ; Author: Stephen Podhajecki {eltorro} [^gehossafats@netmdc.com] ; ; This is a port of GNU getopt command line parser. It was ported from the ; python implementation found with python 2.5. ; This port is able to handle ; short options (ex. -a -b -c), ; short options with paramenters (ex. -o outfile.txt -ooutfile.txt) ; short options with optional parameters (ex. -d or -d5 or -d 5) ; grouped short options (ex. -abc equivalent to -a -b -c) ; Note: That a short option requiring an parameter can be part of a group IF IT IS THE LAST option of the group. ; ; Short options that require a parameter are followed by a ":" in the short option string. ; If the parameter is itself optional, the option is followed by "::" instead of ":". ; example short option string: ; $shortOptions = "abF::o:v" ; in the above example a, b, v are basically switches ; F has an optional parameter with it, o absolutely requires a parameter. ; ; long options (ex. --use-beta) ; long options with parameters (ex. --output-file outfile.txt --output-file=outfile.txt) ; Long options that require a parameter are followed by an equals sign ("=") ; example long option array: ; Local $aLongOptions[3]=["input-listfile=","use-beta","version"] ; In the above example, "input-listfile" requires a parameter, the others ; do not. ; ; Valid options are contained in the short option string and the long option array. ; Note: Notice that absence of dashes in the valid options above ; ; ------------------------------------------------------------------------------ ; ==================================================================================================== =========================== ; Python version of getopt converted to Au3. ; ==================================================================================================== =========================== ; #FUNCTION# ==================================================================================================== ================= ; Description ...: Parses the command line arguments into a 2 dim array ; Parameters ....: $args - IN/OUT - Commandline arguments. This variable will be modified make a copy if you want to retain original. ; $sShort - IN - String of short options "abco:" etc. ; $aLong - IN - An array of long options ; Return values .: On Success - A two dim array with the option in element 0 of second dim and param (if any) in elememt 1 ; On Failure - 0 ; Author ........: Stephen Podhajecki {gehossafats at netmdc. com} ; Remarks .......: When a commandline option is found, it is removes from the list and places in the 2D array. ; $args with contain only non-option arguments when the function returns. ; Related .......: ; ==================================================================================================== ============================ Func _OPT_GetOpt(ByRef $args, $sShort, $aLong) Local $opts[1][2], $arg0, $iIndex While UBound($args) And _getopt_StringStartsWith($args[0], "-") And $args[0] <> "-" If $args[0] = "--" Then _OPT_FIFO($args[0]) ExitLoop EndIf If $args[0] = "" Then ExitLoop $arg0 = $args[0] _OPT_FIFO($args) Select Case _getopt_StringStartsWith($arg0, "--") $opts = _getopt_do_longs($opts, StringTrimLeft($arg0, 2), $aLong, $args) If @error Then Return SetError(@error, @extended, 0) Case _getopt_StringStartsWith($arg0, "-") $opts = _do_shorts($opts, StringTrimLeft($arg0, 1), $sShort, $args) If @error Then Return SetError(@error, @extended, 0) EndSelect WEnd $iIndex = UBound($opts) - 1 If $iIndex > 1 Then If $opts[$iIndex][0] = "" Then ReDim $opts[$iIndex][2] EndIf EndIf Return $opts EndFunc ;==>getopt ; #FUNCTION# ==================================================================================================== ================= ; Description ...: Checks a comma separated list of options for a match. ; Parameters ....: $vArgs - IN - The options to check for ; $options - IN - The options list returned by _GetOpt() ; $iIndex - IN/OUT - The index of the item, if found. ; Return values .: On Success - True ; On Failure - False, @error set to 1 ; Author ........: Stephen Podhajecki {gehossafats at netmdc. com} ; Remarks .......: The $iIndex variable is used to hold the index of a match.It's initial value is always set to -1. ; If a match is found, it is set to the index. ; Related .......: ; ==================================================================================================== ============================ Func _OPT_MatchOption($vArgs,$options,ByRef $iIndex) $iIndex = -1 Local $aArgs = StringSplit($vArgs,",") If @error and Not (IsArray($aArgs)) Then return SetError(1,0,"") _OPT_FIFO($aArgs) For $i = 0 to UBound($options)-1 For $j in $aArgs If $j = $options[$i][0] Then $iIndex = $i Return True EndIf Next Next Return SetError(1,0,False) EndFunc ; ==================================================================================================== =========================== ; _getopt_do_longs: Check for long format arguments ex. --version or --outfile="c:\myfile.txt" --outfile c:\myfile.txt ; ==================================================================================================== =========================== Func _getopt_do_longs($opts, $opt, $longopts, ByRef $args) Local $optarg, $has_arg, $iIndex, $i $i = StringInStr($opt, '=') If $i Then $optarg = StringRight($opt, $i + 1) $opt = StringLeft($opt, $i) Else $optarg = "" EndIf $has_arg = _getopt_long_has_args($opt, $longopts) If @error Then Return SetError(@error, @extended, 0) If $has_arg Then If $optarg = "" Then If Not (UBound($args)) Or _getopt_StringStartsWith($args[0], "-") Then ConsoleWrite(StringFormat("option --%s requires argument\n", $opt)) Return SetError(1, 0, 0) ;Exit (-1) EndIf If Not (_getopt_StringStartsWith($optarg, "-")) Then $optarg = $args[0] _OPT_FIFO($args) EndIf EndIf Else If $optarg <> "" Then ConsoleWrite(StringFormat("option --%s must not have an argument\n", $opt)) Return SetError(2, 0, 0) ;Exit (-2) EndIf EndIf $iIndex = UBound($opts, 1) - 1 _getopt_Expand2d($opts) $opts[$iIndex][0] = "--" & $opt $opts[$iIndex][1] = $optarg Return $opts EndFunc ;==>_getopt_do_longs ; ==================================================================================================== =========================== ; _getopt_long_has_args(): returns True if the option requires an argument, False if no required argument. ; ==================================================================================================== =========================== Func _getopt_long_has_args(ByRef $opt, $longopts) Local $has_arg, $unique_match, $possibilities[1] For $o In $longopts If _getopt_StringStartsWith($o, $opt) Then _getopt_ArrayAppend($possibilities, $o) Next If UBound($possibilities) < 2 Then ConsoleWrite(StringFormat('option --%s not recognized\n', $opt)) Return SetError(3, 0, 0) ;Exit (-3) EndIf ; Is there an exact match? For $p In $possibilities If $opt & "=" = $p Then Return True ElseIf $opt = $p Then Return False EndIf Next If UBound($possibilities) > 1 Then ConsoleWrite(StringFormat('option --%s not a unique prefix\n', $opt)) Return SetError(4, 0, 0) ;Exit (-4) EndIf $unique_match = $possibilities[0] $has_arg = _getopt_StringEndsWith($unique_match, "=") If $has_arg Then $unique_match = StringTrimRight($unique_match, 1) EndIf $opt = $unique_match Return $has_arg EndFunc ;==>_getopt_long_has_args ; ==================================================================================================== =========================== ; _do_shorts: Parse for short format (single letter) options. ex. -a -b -o c:\outfile.txt or -abo c:\outfile.txt ; ==================================================================================================== =========================== Func _do_shorts($opts, $optstring, $shortopts, ByRef $args) Local $opt, $optarg, $has_short, $iIndex, $iOptCount = 0 While $optstring <> '' $opt = StringLeft($optstring, 1) $optstring = StringStripWS(StringTrimLeft($optstring, 1), 3) $has_short = _getopt_short_has_arg($opt, $shortopts) If @error Then Return SetError(@error, @extended, 0) Switch $has_short Case 2 If $optstring <> "" Then If $iOptCount Then $optarg = "" Else $optarg = $optstring $optstring = "" _OPT_FIFO($args[0]) EndIf Else If _getopt_StringStartsWith($args[0], "-") Then $optarg = "" Else $optarg = $args[0] _OPT_FIFO($args) EndIf EndIf Case 1 If $optstring = "" Then If Not (UBound($args)) Or _getopt_StringStartsWith($args[0], "-") Then ConsoleWrite(StringFormat('option -%s requires argument\n', $opt)) Return SetError(5, 0, 0) ;Exit (-5) EndIf $optstring = $args[0] _OPT_FIFO($args) EndIf $optarg = $optstring $optstring = "" Case Else $optarg = '' EndSwitch $iIndex = UBound($opts) - 1 _getopt_Expand2d($opts) $opts[$iIndex][0] = "-" & $opt $opts[$iIndex][1] = $optarg $iOptCount += 1 WEnd Return $opts EndFunc ;==>_do_shorts ; ==================================================================================================== =========================== ; _getopt_short_has_arg(): Returns 0 if the options does not require an argument, 1 if an argument is require, 2 if argument is optional ; ==================================================================================================== =========================== Func _getopt_short_has_arg($opt, $shortopts) For $i = 1 To StringLen($shortopts) If $opt = StringMid($shortopts, $i, 1) And $opt <> ":" Then If StringMid($shortopts, $i + 1, 2) = "::" Then Return 2 EndIf Return StringMid($shortopts, $i + 1, 1) = ":" EndIf Next ConsoleWrite(StringFormat('option -%s not recognized\n', $opt)) Return SetError(7, 0, 0) ;Exit (-7) EndFunc ;==>_getopt_short_has_arg ; ==================================================================================================== =========================== ; _OPT_FIFO() : pops an element from the front of an array. ; ==================================================================================================== =========================== Func _OPT_FIFO(ByRef $aArray) If Not IsArray($aArray) Then Return SetError(1, 0, 0) For $x = 1 To UBound($aArray) - 1 $aArray[$x - 1] = $aArray[$x] Next $aArray[UBound($aArray) - 1] = "" If UBound($aArray) > 1 Then ReDim $aArray[UBound($aArray) - 1] EndIf Return True EndFunc ;==>_OPT_FIFO ; ==================================================================================================== =========================== ; _getopt_Expand2d(): Dynamically increase the size of a 2 dim array. ; ==================================================================================================== =========================== Func _getopt_Expand2d(ByRef $aArray, $iSubScript = 1, $iCount = 1) If UBound($aArray, 0) <> 2 Then Return SetError(0) Switch $iSubScript Case 1 ReDim $aArray[UBound($aArray, 1) + $iCount][UBound($aArray, 2) ] Case 2 ReDim $aArray[UBound($aArray, 1) ][UBound($aArray, 2) + $iCount] Case Else Return SetError(1, 0, 0); subscript out of range. EndSwitch Return True EndFunc ;==>_getopt_Expand2d ; ==================================================================================================== =========================== ; _getopt_ArrayAppend(): Dynamically expand a 1 dim array and add a value to it. ; ==================================================================================================== =========================== Func _getopt_ArrayAppend(ByRef $aArray, $vData) Local $iIndex = UBound($aArray) Local $iVindex = 0 If IsArray($vData) Then $iVindex = UBound($vData) ReDim $aArray[$iIndex + ($iVindex) + 1 ] For $x = 0 To $iIndex $aArray[$x + $iVindex] = $vData[$x] Next Return EndIf ReDim $aArray[$iIndex + 1] $aArray[$iIndex] = $vData EndFunc ;==>_getopt_ArrayAppend ; ==================================================================================================== =========================== ; _getopt_StringStartsWith(): Check if a string begins with the specified character(s). ; ==================================================================================================== =========================== Func _getopt_StringStartsWith($szString, $szFind, $iStart = 1, $iEnd = -1, $iFlag = 0) If $szString = "" Or $szFind = "" Then Return SetError(1, 0, False) If $iEnd < 0 Then $iEnd = StringLen($szString) If $iStart > $iEnd Or $iStart < 1 Then Return SetError(1, 0, 0) If $iEnd > StringLen($szString) - ($iStart - 1) Then $iEnd = StringLen($szString) - ($iStart - 1) $szString = StringMid($szString, $iStart, $iEnd) If $iFlag = 0 Then If StringLeft($szString, StringLen($szFind)) = $szFind Then Return True Else If StringLeft(StringUpper($szString), StringLen($szFind)) = StringUpper($szFind) Then Return True EndIf Return False EndFunc ;==>_getopt_StringStartsWith ; ==================================================================================================== =========================== ; _getopt_StringEndsWith(): Checks if a string ends with the specified characters. ; ==================================================================================================== =========================== Func _getopt_StringEndsWith($szString, $szFind, $iFlag = 0) If $szString = "" Or $szFind = "" Then Return SetError(1, 0, 0) Switch $iFlag Case 1 Return StringRight(StringUpper($szString), StringLen($szFind)) = StringUpper($szFind) Case Else Return StringRight(($szString), StringLen($szFind)) = ($szFind) EndSwitch Return False EndFunc ;==>_getopt_StringEndsWith Edited December 8, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code
microsoft Posted December 8, 2007 Posted December 8, 2007 how To Use The Script Encode Please Writ Example Easy . Thanks
eltorro Posted December 8, 2007 Author Posted December 8, 2007 (edited) how To Use The Script Encode Please Writ Example Easy . Thanks Using the base32 udf in another program: #include <base32.au3> $a = _Base32_Encode("AutoIt3") MsgBox(0,"Encoded",$a) $b = _Base32_Decode($a) MsgBox(0,"Decoded",$B) Using the command line utility from the 1st post. From a cmd window. expandcollapse popupMicrosoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Program Files\AutoIt3\Scripts>base32 base32 -- Encode/decode file or string as base32. Call: base32 [-e / -d] [options] [infile] [outfile] Options: -d, --decode Decode base32 encoded file/string -e, --encode Encode file/string into base32 -s, --string Argument is a string value -h, --help Print this message --version Print version number Stephen Podhajecki http://ocotillo.sytes.net Original Java version Author: Frederik Zimmer Copyright (C) 2001 tristian@users.sourceforge.net tristian@users.sourceforge.net C:\Program Files\AutoIt3\Scripts>base32 AutoIt3 IF2XI32JOQZQ C:\Program Files\AutoIt3\Scripts>base32 -e AutoIt3 IF2XI32JOQZQ C:\Program Files\AutoIt3\Scripts>base32 -d IF2XI32JOQZQ AutoIt3 C:\Program Files\AutoIt3\Scripts>type test.txt Just a stupid text file. C:\Program Files\AutoIt3\Scripts>base32 -e test.txt test.b32 C:\Program Files\AutoIt3\Scripts>type test.b32 JJ2XG5BAMEQHG5DVOBUWIIDUMV4HIIDGNFWGKLQ C:\Program Files\AutoIt3\Scripts>base32 -d test.b32 test1.txt C:\Program Files\AutoIt3\Scripts>type test1.txt Just a stupid text file. C:\Program Files\AutoIt3\Scripts>exit Edited December 8, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code
WeMartiansAreFriendly Posted January 18, 2008 Posted January 18, 2008 (edited) Looks interesting! ...Could you please upload the scripts. the damn forum screws up the formating (clips long lines into new lines) Edited January 18, 2008 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
eltorro Posted January 24, 2008 Author Posted January 24, 2008 (edited) Looks interesting!...Could you please upload the scripts. the damn forum screws up the formating (clips long lines into new lines)Here ya go.base32.zip Edited February 28, 2008 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now