md5_otp(3trf)
okay bestie, sit down, hydrate, this is the md5_otp(3trf) page β yeah, the 3trf manual β and it's giving message-digest royalty. no cap. π
β¨ NAME β¨
md5_otp β Message digest "md5_otp" π«Ά
πΈ SYNOPSIS πΈ
package require Tcl ?8.2?
package require Trf ?2.1.3?
md5_otp ?options...? ?data?
π DESCRIPTION π
md5_otp is one of the several message digests that the trf package ships, periodt. wanna meet the whole squad? go read trf-intro for the overview of the entire package, iykyk.
md5_otp ?options...? ?data?
the options down here are understood by the digest if and only if the digest is attached to a channel β like, that's the whole vibe check. for the lore on what "attached" even means, scroll to IMMEDIATE versus ATTACHED. π
-mode absorb|write|transparentβ this one has to be present, no skips. the argument you give it decides how the digest behaves in attached mode. and btw, besides those three values, all unique abbreviations are recognized too, slay. meanings incoming:absorbβ all data written to the channel gets used to calculate the value of the message digest, and then gets passed along unchanged to the next level in the stack of transformations for the channel the digest is attached to. when the channel is closed, the completed digest is written out too β essentially attaching the value of the digest after the information actually written to the channel. and when you're reading from the channel, a value for the digest is computed too, and after the channel closes it gets compared to the digest which was attached, i.e. the one that came behind the actual data. the option-matchflaghas to be specified so the digest knows where to store the result of that comparison. that result is a string and it's either"ok"or"failed". π€writeβ all data read from or written to the channel the digest is attached to is ignored and thrown away π only a value for the digest of the data gets computed. when the channel is closed, the computed values are stored as ordered through the options-write-destination,-write-type,-read-destination, and-read-type.transparentβ the lovechild ofabsorbandwrite. likeabsorb, all data β read or written β passes through the digest unchanged. but the generated values for the digest are handled exactly like inwrite. π§
-matchflag varnameβ can be used if and only if-mode absorbis present. in that situation the argument is the name of a global or namespaced variable, and the digest writes the result of comparing the two digest values into it. the option gets ignored if the channel is write-only, because then there's no comparison of digest values happening at all. π-write-type variable|channelβ usable for digests in modewriteortransparent. besides those values, all their unique abbreviations are allowed as argument values too. it determines the type of the argument to-write-destination. it defaults tovariable. β-read-type variable|channelβ like-write-type, but for-read-destination. π-write-destination dataβ usable for digests in modewriteortransparent.datais either the name of a global (or namespaced) variable, or the handle of a writable channel, depending on-write-type. the message digest computed for data written to the attached channel is written into it after the attached channel was closed. the option is ignored if the channel is read-only.
heads up bestie: using a variable may yield incorrect results under tcl 7.6, because of embedded \0's. π
-read-destination dataβ usable for digests in modewriteortransparent.datais either the name of a global (or namespaced) variable, or the handle of a writable channel, depending on-read-type. the message digest computed for data read from the attached channel is written into it after the attached channel was closed. the option is ignored if the channel is write-only.
same warning fr fr: using a variable may yield incorrect results under tcl 7.6, due to embedded \0's. π
the options below are always understood by the digest β attached versus immediate does not matter. see IMMEDIATE versus ATTACHED for the explanations of those two terms. π
-attach channelβ the presence/absence of this option determines the main operation mode of the transformation. if it's present, the transformation gets stacked onto the channel whose handle was given to the option and runs in attached mode. more on that in IMMEDIATE versus ATTACHED. if it's absent, the transformation is used in immediate mode and the options below are recognized. more on that in IMMEDIATE versus ATTACHED too. π-in channelβ legal if and only if the transformation is used in immediate mode. it provides the handle of the channel the data to transform has to be read from. if the transformation is in immediate mode and this option is absent, the data to transform is expected as the last argument to the transformation.-out channelβ legal if and only if the transformation is used in immediate mode. it provides the handle of the channel the generated transformation result is written to. if the transformation is in immediate mode and this option is absent, the generated data is returned as the result of the command itself.
π IMMEDIATE VERSUS ATTACHED π
the transformation distinguishes between two main ways of using it: the immediate and attached operation modes.
for the attached mode you use -attach to associate the transformation with an existing channel. during the execution of the command no transformation is performed β instead the channel is changed in such a way that from then on all data written to or read from it passes through the transformation and is modified by it according to the definition above. this attachment can be revoked by executing the command unstack for the chosen channel. that is the only way to do this at the Tcl level, periodt.
in the second mode, which you can detect by the absence of -attach, the transformation immediately takes data from either its commandline or a channel, transforms it, and returns the result either as the result of the command, or writes it into a channel. the mode is named after the immediate nature of its execution. β‘
where the data is taken from and delivered to is governed by the presence and absence of the options -in and -out. and you should lowkey know this: the ability to immediately read from and/or write to a channel is a historic artifact, introduced at the beginning of Trf's life when Tcl version 7.6 was current β because that version and earlier ones have trouble dealing with \0 characters embedded into either input or output. π
π₯ SEE ALSO π₯
adler, crc, crc-zlib, haval, md2, md5, md5_otp, ripemd-128, ripemd-160, sha, sha1, sha1_otp, trf-intro
π KEYWORDS π
authentication, hash, hashing, mac, md5_otp, message digest
π COPYRIGHT π
Copyright (c) 1996-2003, Andreas Kupries <andreas.kupries@users.sourceforge.net>
and that's the whole page, bestie β brought to you by the Trf transformer commands, version 2.1.3, dated... also 2.1.3 (the date slot is just the version again, don't ask π). go hash something iconic. πβ¨
π¦ where this page comes from
- debian bookworm: tcl-trf-doc 2.1.4-dfsg3-2.1
- debian trixie: tcl-trf-doc 2.1.4-dfsg3-8
- ubuntu jammy: tcl-trf-doc 2.1.4-dfsg3-2.1build1
- ubuntu noble: tcl-trf-doc 2.1.4-dfsg3-3
- ubuntu questing: tcl-trf-doc 2.1.4-dfsg3-8
- ubuntu resolute: tcl-trf-doc 2.1.4-dfsg3-8build1
- ubuntu stonking: tcl-trf-doc 2.1.4-dfsg3-9build1
- Copyright (c) 1996-2003, Andreas Kupries <andreas_kupries@users.sourceforge.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms