%3 ::nx::Object ::nx::Object ::ns_crypto::HashFunctions ::ns_crypto::HashFunctions readfile ::ns_crypto::HashFunctions->::nx::Object ::ns_hmac ::ns_hmac → file → string add destroy get init ::ns_hmac->::ns_crypto::HashFunctions ::ns_md ::ns_md → file → string add destroy get init ::ns_md->::ns_crypto::HashFunctions

Class ::ns_crypto::HashFunctions

::ns_crypto::HashFunctions[i] create ... \
           [ -ctx ctx ] \
           [ -digest (default "sha256") ]

Defined in

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::nx::Object[i]
  • subclass: ::ns_hmac[i], ::ns_md[i]
::nx::Class create ::ns_crypto::HashFunctions \
     -superclass ::nx::Object

Methods (to be applied on instances)

  • readfile (scripted, public)

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

    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.
    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]