FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version


Arguments: context &key return

Finalize and return the SHA1 hash from context in a format determined by the return keyword argument.

return can be one of the following values:

cl-user(4): (setq c (sha1-init))
#S(excl::md-context :ctx 156672 :size 20)
cl-user(5): (sha1-update c "foo")
cl-user(6): (sha1-final c :return :usb8)
#(11 238 199 181 234 63 15 219 201 93 ...)

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

;; Now we get it with SHA1-FILE:
cl-user(17): (sha1-file "~/cmp05-optdialog.jpg")
cl-user(18): (format t "~x" *)

;; 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): (sha1-file "~/cmp05-optdialog.jpg" :return :hex)

See MD5, SHA*, HMAC, RC4, and other message digest support in miscellaneous.htm. See also digest-final.

Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 9.0 page.
Created 2015.5.21.

Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version