FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1. Significant update since 8.1 release.
8.0 version

md5-final

Arguments: context &key return

Compute and return the MD5 checksum from context, an integer of length 128 or less. md5-init returns a context, in a format determined by the return keyword argument.

return can be one of the following values:

In an earlier version, the keyword argument to md5-final was named :usb8-result rather than :return and only two return modes were provided: :integer (with ':usb8-result nil') and :usb8 (with ':usb8-result t'). The :usb8-result is no longer supported.

cl-user(4): (setq c (md5-init))
#(1 35 69 103 137 171 205 239 254 220 ...)
cl-user(5): (md5-update c "foo")
cl-user(6): (md5-final c :return :usb8)
#(172 189 24 219 76 194 248 92 237 239 ...)

;;  Potential problem with :return :integer (or :return unspecified
;;  as the default is :integer). The call is to MD5-FILE which calls
;;  MD5-FINAL and returns the value MD5-FINAL returns.
;;
;;  Here we get the md5 value in a shell:
%  openssl dgst -md5 -hex cmp05-optdialog.jpg
MD5(cmp05-optdialog.jpg)= 03c6f3f0ede5188ac49c30e11e7afa4e

;; Now we get it with MD5-FILE:
cl-user(17): (md5-file "~/cmp05-optdialog.jpg")
5020706479262241505478555770059160142
cl-user(18): (format t "~x" *)
3c6f3f0ede5188ac49c30e11e7afa4e
nil
cl-user(19): 

;; Note the hex values are the same but the leading 0 is not printed
;; by Lisp, which is dealing with the value as an integer. The leading
;; 0 is preserved when the :return is :hex:
cl-user(21): (md5-file "~/cmp05-optdialog.jpg" :return :hex)
"03c6f3f0ede5188ac49c30e11e7afa4e"
cl-user(22): 

See MD5, SHA1, HMAC, and RC4 support in miscellaneous.htm.


Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page was not revised from the 8.0 page.
Created 2009.7.29.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1. Significant update since 8.1 release.
8.0 version