<namesection> <name>trf-intro</name> <desc>Introduction to Trf</desc> </namesection> <synopsis> <syntax> package require <package>Tcl</package> <o>8.2</o> package require <package>Trf</package> <o>2.1.3</o> </syntax> </synopsis>
The package <package>Trf</package> provides a number of commands which take data and transform them in various ways.
BACKGROUND The implementation of Trf began as proof-of-concept of the validity and usefulness of the "stacked channel" patches to the core. These patches allow the writing of extensions to the generic I/O system of the core which are able to intercept all read/write operations on designated channels, thus giving it the ability to transform the data flowing through these channels as desired.

This allows things like transparent encryption, compression, charset recoding, etc.

Since version 8.2 of the tcl core the aforementioned patches are part of the tcl core itself, changing the status of <package>trf</package> from "extension requiring core patches" to "normal extension".

Other packages built upon either the stackd channels directly, or Trf are:

1. <package>TrfCrypt</package>, by myself, contains various encryption systems
2. <package>TLS</package>, an SSL/TLS implementation by Matt Newman.
3. <package>Tcl MIME</package> by Marshall Rose.

API The commands provide by <package>trf</package> can be placed into the three categories listed below. Note that all commands are added to the global namespace.

<dle>
<term>Encodings</term>
  The encoding commands either take some data and return the same data in encoded form, or take encoded data and return a decoded result.
  1. <cmd>oct</cmd>
  2. <cmd>hex</cmd>
  3. <cmd>oct</cmd>
  4. <cmd>base64</cmd>
  5. <cmd>uuencode</cmd>
  6. <cmd>ascii85</cmd>
  7. <cmd>otp_words</cmd>
  8. <cmd>quoted-printable</cmd>
</dle> <dle>
<term>Message Digests</term>
  The second category are message digests in general, simple ones like <cmd>crc</cmd>, and cryptographically strong algorithms like <cmd>md5</cmd>.
  1. <cmd>crc-zlib</cmd>
  2. <cmd>crc</cmd>
  3. <cmd>adler</cmd>
  4. <cmd>md2</cmd>
  5. <cmd>md5</cmd>
  6. <cmd>md5_otp</cmd>
  7. <cmd>sha</cmd>
  8. <cmd>sha1</cmd>
  9. <cmd>sha1_otp</cmd>
  10. <cmd>haval</cmd>
  11. <cmd>ripemd-160</cmd>
  12. <cmd>ripemd-128</cmd>
</dle> <dle>
Miscellaneous
  At last a number of commands not readily placed into categories providing password crypting, general transformations, data compression, error correction and others.
  1. <cmd>crypt</cmd>
  2. <cmd>md5crypt</cmd>
  3. <cmd>transform</cmd>
  4. <cmd>rs_ecc</cmd>
  5. <cmd>zip</cmd>
  6. <cmd>bz2</cmd>
  7. <cmd>unstack</cmd>
</dle>

<seealso> <ref>oct</ref> <ref>hex</ref> <ref>oct</ref> <ref>base64</ref> <ref>uuencode</ref> <ref>ascii85</ref> <ref>otp_words</ref> <ref>quoted-printable</ref> <ref>crc-zlib</ref> <ref>crc</ref> <ref>adler</ref> <ref>md2</ref> <ref>md5</ref> <ref>md5_otp</ref> <ref>sha</ref> <ref>sha1</ref> <ref>sha1_otp</ref> <ref>haval</ref> <ref>ripemd-160</ref> <ref>ripemd-128</ref> <ref>crypt</ref> <ref>md5crypt</ref> <ref>transform</ref> <ref>rs_ecc</ref> <ref>zip</ref> <ref>bz2</ref> </seealso> <keywords> <keyword>transformation</keyword> <keyword>encoding</keyword> <keyword>message digest</keyword> <keyword>compression</keyword> <keyword>error correction</keyword> </keywords>