This procedure is defined in the server but not documented via ad_proc or proc_doc and may be intended as a private interface.
The procedure is defined as:
proc md5::md5 {args} {
array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
while {[string match -* [set option [lindex $args 0]]]} {
switch -glob -- $option {
-hex { set opts(-hex) 1 }
-file* { set opts(-filename) [Pop args 1] }
-channel { set opts(-channel) [Pop args 1] }
-chunksize { set opts(-chunksize) [Pop args 1] }
default {
if {[llength $args] == 1} { break }
if {[string compare $option "--"] == 0} { Pop args; break }
set err [join [lsort [array names opts]] ", "]
return -code error "bad option $option: must be one of $err\nlen: [llength $args]"
}
}
Pop args
}
if {$opts(-filename) != {}} {
set opts(-channel) [open $opts(-filename) r]
fconfigure $opts(-channel) -translation binary
}
if {$opts(-channel) == {}} {
if {[llength $args] != 1} {
return -code error "wrong # args: should be \"md5 ?-hex? -filename file | string\""
}
set tok [MD5Init]
MD5Update $tok [lindex $args 0]
set r [MD5Final $tok]
} else {
set tok [MD5Init]
# FRINK: nocheck
set [subst $tok](reading) 1
fileevent $opts(-channel) readable [list [namespace origin Chunk] $tok $opts(-channel) $opts(-chunksize)]
vwait [subst $tok](reading)
set r [MD5Final $tok]
# If we opened the channel - we should close it too.
if {$opts(-filename) != {}} {
close $opts(-channel)
}
}
if {$opts(-hex)} {
set r [Hex $r]
}
return $r
}