Bencode takes the named source file (the default is standard input) and produces an encoded version on the standard output. The encoding uses only the ASCII characters ``A'' - ``Z'', ``a'' - ``z'', ``0'' - ``9'', ``+'', and ``-''. The ASCII characters blank, newline, and ``/'' also appear in the encoded file, but do not represent encoded bits. The encoded file is terminated with a byte count and cyclic redundancy check for detecting corrupted files.
Bdecode reads a file encoded by bencode (the default is standard input), strips off any leading and trailing lines added by mailers, and writes the decoded version to standard output.
These functions are similar to uuencode and uudecode, but are more robust because of the CRC check and because they don't send characters like ``^'' and ``\'', which are likely to get mangled if the file should happen to pass through a non-ASCII machine.