In case you want to use only the MD5 message digest
you may want to take a look at Bruce S. O. Adams MD5 package
or John Ellson's ftp place instead. The latter location provides
SHA too.
Another extension for authentication hashes is
tclAH by Greg Retkowski. It contains a base64 encoder too.
The package implements 10 message digests
- 2 crc checkers, taken from PGP and library
zlib, under the names crc and crc-zlib
resp.
- The adler-checksum, again taken from zlib.
- MD2, MD5, the OTP variant of MD5
- SHA (or SHS), SHA-1, the OTP variant of SHA1
- HAVAL
- RIPEMD-160, -128
The commands to invoke them are identical to the names,
converted to all lowercase. In immediate mode no options
are allowed. Attached digests have two submodes available:
-mode |
The allowed arguments are ``absorb'', ``write'',
``transparent'' and all unique abbreviations.
In the first submode written data is not changed
except for attachment of the message digest at
the end of the input. During reading a digest is
computed too and then compared to the one attached.
The '-matchflag' must be defined to propagate the
result of the comparison to the tcl-level
(``ok'' or ``failed'').
In the second submode read or written data goes into
nirvana, their digests are computed as side effect.
After the channel is closed the computed digests are
written to the variables and/or channels specified
with '-read/write-destination'.
The ``transparent'' mode is a mixture of both of the
above. As with ``absorb'' all data flows through the
filter unchanged. The generated digests however are
handled the same way as is done by the ``write''-mode.
|
-matchflag |
The value specifies the name of global variable to
write the result of a digest comparison into. Allowed
for mode ``absorb'' only. Its definition for a write-only
channel will be ignored.
|
-write-destination |
The value is either interpreted as the name of a global
variable or the handle of a writable channel, dependent
on the value of -write-type. The message digest
computed for data written to the attached channel is
written into it after closing the attached channel. Allowed
for mode ``write'' only. Its definition for a readonly
channel is ignored. Using a variable may yield incorrect
results under tcl 7.6, due to embedded \0's.
|
-write-type |
Possible values are variable, channel and
all unique abbreviations of these. If this option is not
given, variable will be used as default. See
-write-destination above for meaning and usage.
|
-read-destination |
The value is either interpreted as the name of a global
variable or the handle of a writable channel, dependent on
the value of -read-type. The message digest computed
for data read from the attached channel is written into it
after closing the attached channel. Allowed only for mode
``write''. Its definition for a readonly channel is ignored.
Using a variable may yield incorrect results under
tcl 7.6, due to embedded \0's.
|
-read-type |
See -write-type above for an explanation of values
and meaning.
|
|