Base-64 encode/decode

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Base-64 encode/decode

  • Creator
    Topic
  • #51200
    Charlie Bursell
    Participant

    I have told several of you about the Base-64 commands encode and decode which are included with Cloverleaf.  I have just come to the realization that these commands are incredibly  slow (30 seconds for a small PDF file) and may not be completely IAW the RFC (RFC 3548).

    These commands were written in the mid-1990 time frame and many changes have occurred since.  However there are Base-64 encode and decode commands which are RFC 3548 compliant and are very fast.  The base64 package is part of tcllib which is now included with Cloverleaf and has been since at least 5.4, I think.  The version included with Cloverleaf 5.7 is tcllib1.8.  There are also later versions available for download at http://www.tcl.tk/software/tcllib/.  The latest version is tcllib 1.11.  The web page also includes documentation for all of the packages in tcllib.

    The encode/decode commands exist in $HCIROOT/tcl/lib/cloverleaf/util.tlib.  A good work-around would be to edit this file like:

    proc decode {text} {

      package require base64

      return [base64::decode $text]

    }

    proc encode {text} {

        package require base64

        return [base64::encode $text]

    }

    If you have problems with doing the edit, let me know and I will e-mail you a modified copy of the file

    That way when using encode or decode you are actually using the tcllib package.  If you do not want to modify the util.tlib file you can use the base64 package in your Tcl proc

          package require base64

           set b64 [base64::encode $data]

           set data [base64::decode $b64]

    I apologize for any problems the older encode/decode commands may have caused.  We will make sure newer releases of Cloverleaf use the faster more compliant commands

    If you have questions let me know

    Charlie

  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,297
Replies
34,440
Topic Tags
287
Empty Topic Tags
10