NAME
muter - tool to convert between various formats
SYNOPSIS
muter [-r] -c chain [file...]
muter [--verbose] --help
DESCRIPTION
muter is a tool to process data by encoding and decoding it in various formats. The series of transforms being used is described by the chain.
Like most Unix command line tools, muter processes the files specified on the command line, or standard input if no files are specified. It produces output to standard output. Input and output are generally assumed to be a series of bytes; where character interpretation is required, UTF-8 is used.
A chain is a series of transforms separated by colons. A reverse transform (decoding) is specified by preceding the transform with a -
character. If a transform takes parameters, they are separated by commas and follow the transform either surrounded by parentheses or preceded by a comma. Unknown parameters are ignored.
Not all transforms have an reverse transforms. For example, the hash transform, which implements cryptographic hashes, is not practically invertible (we hope). An exception will be thrown if you attempt to use an invalid transform.
Generally, a reverse transform will decode any variant of the forward transform. To preserve this invariant, related but incompatible transforms such as base64 and url64 are separate transforms.
In general, muter expects the input to its decoders to be well-formed. Passing broken or corrupt data will not generally produce useful results. For example, it isn't a good idea to try to decode URI-encoded data containing unencoded newlines. In other words, garbage in, garbage out.
OPTIONS
- -c chain, --chain=chain
-
Specify the chain of transforms. This option is mandatory.
- -r, --reverse
-
Reverse the chain of transforms and convert each forward transform to a reverse transform, and vice versa. Assuming all transforms can be inverted, running an instance of muter without this flag followed by an instance with this flag and with the same chain returns the original data.
It is not valid to specify this flag with transforms that have no inverse.
- --help
-
List usage and all known transforms.
- --verbose
-
With --help, provide a description for each transform parameter.
BACKENDS
The following backends are included with muter; additional backends can be used by creating modules under the App::Muter::Backend
namespace in @INC
.
ascii85
Implements the Ascii85 encoding.
base16
Equivalent to the hex
backend with the upper
argument. Implements the RFC 4648 Base16 encoding.
base32
Implements the RFC 4648 Base32 encoding.
Accepts one option, manual
, which forces the use of the built-in encoder instead of MIME::Base32. This built-in encoder is forced if MIME::Base32 is missing or too old.
base32hex
Implements the RFC 4648 Base32 with Extended Hex Alphabet encoding, better known as base32hex
.
Accept one option, manual
, which does the same thing as for base32
.
base64
Implements the RFC 4648 Base64 encoding.
hash
Implements a cryptographic hash of the input data. There is no corresponding reverse transform.
The following hash algorithms are supported:
hex
Implements hex encoding. Takes two options, lower
and upper
, that control which type of letters are used.
identity
Implements the identity transform. Passes through the input unmodified.
quotedprintable
Implements quoted-printable MIME encoding. With the option smtp
, encodes "." and "From " if they appear at the beginning of a line (including beginning of input).
uri
Implements URI percent encoding.
Takes three possible options. lower
and upper
control the type of hex character emitted, and form
makes space be encoded as +
instead of %20
(as for use in application/x-www-form-urlencoded.
url64
Implements the RFC 4648 Base64 Encdoing with URL and Filename Safe Alphabet.
uuencode
Implements UUencoding. Note that the "begin" and "end" markers are not emitted.
vis
Implements the vis(3) function found on the BSDs. The options supported correspond directly to the constants that function takes.
The default encoding, if neither cstyle
nor octal
is specified, is to encode control characters in the form \^C
, control characters with the eighth bit set in the form \M^C
, other characters with the eighth bit in the form \M-C
, and space and meta-space as octal escapes.
The flags httpstyle
and mimestyle
are not implemented. Instead, use the uri
and quotedprintable
encoders.
- cstyle
-
Use C-style backslash escapes for common control characters. Space is encoded as
\s
. NUL is encoded as\0
if the next character is not an octal digit and\000
if it is. - glob
-
Encode the characters
*
,?
,[
and#
, which are recognized by glob(3). - nl
-
Encode newline.
- octal
-
Encode characters as three-digit octal escapes.
- sp
- space
-
Encode space (U+0020).
- tab
-
Encode tab.
- white
-
Encode whitespace. Equivalent to
space,tab,nl
.
xml
Implements encoding of XML special characters. Note that the reverse transform decodes arbitrary decimal and hexadecimal entities into UTF-8.
Takes one of the following three arguments:
- default
-
Use XML entity names.
- hex
-
Use hexadecimal entity names for all entities.
- html
-
Use XML entitiy names, except for the apostrophe, which uses a hexadecimal entity.
EXAMPLES
- muter -c -base64:uri
-
Decode the standard input as Base64 and output it, encoding it using URI percent-encoding.
- muter -r -c -uri:base64
-
Exactly the same as the above.
- muter -c -hex:hash(sha256):base64 file
-
Read from file, which contains a single hex-encoded string, hash the result with SHA-256, and encode the result as base64. This chain could also be written as
-hex:hash,sha256:base64
, which may be easier to type.