ns_crypto::HashFunctions method readfile (public)

 <instance of ns_crypto::HashFunctions[i]> readfile \
    [ -encoding encoding ] filename

Defined in

Read a file blockwise and call the incremental crypto function on every block.

Switches:
-encoding (optional, defaults to "hex")
Parameters:
filename (required)

Testcases:
No testcase defined.
Source code:
set F [open $filename]
fconfigure $F -translation binary
while (1) {
    set block [read $F 32768]
    :add $block
    if {[string length $block] < 32768} {
        break
    }
}
close $F
#
# Return the hash sum
#
return [:get -encoding $encoding]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: