md5::MD5Final (public)
md5::MD5Final token
Defined in packages/acs-tcl/tcl/tcllib-doc-procs.tcl
Finalize an incremental MD5 digest and release its state.
- Parameters:
- token (required)
- Token returned by MD5Init.
- Returns:
- The binary MD5 digest.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar #0 $token state # Check for either of the C-compiled versions. if {[info exists state(md5c)]} { set r $state(md5c) unset state return $r } elseif {[info exists state(ckctx)]} { cryptkit::cryptEncrypt $state(ckctx) "" cryptkit::cryptGetAttributeString $state(ckctx) CRYPT_CTXINFO_HASHVALUE r 16 cryptkit::cryptDestroyContext $state(ckctx) # If nothing was hashed, we get no r variable set! if {[info exists r]} { unset state return $r } } elseif {[info exists state(trf)]} { close $state(trf) set r $state(trfwrite) unset state return $r } # RFC1321:3.1 - Padding # set len [string length $state(i)] set pad [expr {56 - ($len % 64)}] if {$len % 64 > 56} { incr pad 64 } if {$pad == 0} { incr pad 64 } #puts "P $pad|bits=[expr {8 * $state(n)}]" append state(i) [binary format a$pad \x80] # RFC1321:3.2 - Append length in bits as little-endian wide int. append state(i) [binary format ii [expr {8 * $state(n)}] 0] #puts DATA=[Hex $state(i)]([string length $state(i)]) # Calculate the hash for the remaining block. set len [string length $state(i)] for {set n 0} {($n + 64) <= $len} {} { MD5Hash $token [string range $state(i) $n [incr n 64]] } #puts md5-post__________________________________________ #parray ::${token} # RFC1321:3.5 - Output set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)] unset state #puts HASH=[Hex $r] return $rXQL Not present: Generic, PostgreSQL, Oracle