base64, a
Tcllib module, provides commands for encoding and decoding binary data in
base64. In Tcl
8.6, it has largely been superseded by
binary, which also provides base64 encoding and decoding.
Sub-modules edit
- uuencode
- yencode
- ascii85
Documentation edit
- official reference (alternates 1, 2
See Also edit
- Base 64 encode/decode
- shows an example of this Tcllib module at work.
- Inline GIF image into code ,Cookbook
- an example of processesing GIFs using base64
- Simple Base64 Gif encoder
- another example
Obsolete Information edit
The following information is no longer particularly relevant. It remains for historical purposes.
The base64 which is part of tcllib is slow, and catastrophically memory-hungry for large (on the order of a megabyte or more) sources. The memory disaster results from what
Donal Fellows reports as a bug to SourceForge [
1]. He provided a patch as well [
2]. Although it doesn't help performance significantly in the cases of interest to
Cameron Laird, a simple fix for the memory woe is to overide base64::decode with a version which substitutes
set length [string length $string]
for {set ii 0} {$ii < $length} {incr ii} {
set char [string range $string $ii $ii]
...
for
foreach char [split $string {}] {
...
Note: in the current version in tcllib (version 2.2.1 of base64), this code has been replaced bybinary scan $string c* X
foreach x $X {